get_results("SELECT * FROM " . $yydev_secondary_table_name . " WHERE request_url = '{$url_user_request}' OR request_url = '{$full_url_path}' OR request_url = '{$url_without_slash}' OR request_url = '{$urldecode_user_request}'"); // if there are url that require redirection if( count($check_if_redirect_exists) > 0 ) { foreach($check_if_redirect_exists as $check_redirecting) { $redirects_acmount = $check_redirecting->redirects_amount; $new_redirects_acmount = $redirects_acmount + 1; $current_request_url = $check_redirecting->request_url; $request_url = str_ireplace($domains_name, '' , $current_request_url); // getting the url without the domain name $request_url = strtolower($current_request_url); // makindg english caracters not capital $request_url_with_slash = $request_url; $request_url = rtrim($current_request_url, '/'); // removing white space and the slash at the end of the link $urldecode_request_url = urldecode($request_url); // getting the url as regular caracters if it's hebrew $urldecode_request_url_with_slash = urldecode($request_url) . "/"; // ------------------------------------------------ // maksing sure the that $url_user_request is exactly the same as $request_url // ------------------------------------------------ if( ($request_url === $url_user_request) || ($request_url === $url_without_slash) || ($request_url_with_slash === $full_url_path) || ($urldecode_user_request === $urldecode_request_url) || ($urldecode_user_request === $urldecode_request_url_with_slash) ) { $destination_url = $check_redirecting->destination_url; // checking if the destination url is full url with http:// or https:// // and if not we will add the website domain to the destination url if( !strstr($destination_url, "http://") && !strstr($destination_url, "https://") ) { $destination_url = $domains_name . $destination_url; } // if( !strstr($destination_url, "http://") && !strstr($destination_url, "https://") ) { // ------------------------------------------------ // checking which redirection the user choose 301 or // 302 and redirect the user to the correct path // ------------------------------------------------ $redirect_type = $check_redirecting->redirect_type; if($redirect_type === "301") { // update the redirections amount $wpdb->update( $yydev_secondary_table_name, array('redirects_amount'=>$new_redirects_acmount), array('id'=>$check_redirecting->id), array('%d') ); yydev_redirect_redirection_redirect_301($destination_url); } // if($redirect_type === "301") { if($redirect_type === "302") { // update the redirections amount $wpdb->update( $yydev_secondary_table_name, array('redirects_amount'=>$new_redirects_acmount), array('id'=>$check_redirecting->id), array('%d') ); yydev_redirect_redirection_redirect_302($destination_url); } // if($redirect_type === "302") { } // if( ($request_url === $url_user_request) || ($urldecode_user_request === $urldecode_request_url) ) { } // foreach($check_if_redirect_exists as $check_redirecting) { } // if( count($check_if_redirect_exists) > 0 ) { } // if(!empty($url_user_request)) { ?>