Does WP always makes 301 redirection?

Yup, that is very normal. If you don’t want WP to redirect anything. Simply remove the action by adding this code into your working template functions.php file. remove_action( ‘template_redirect’, ‘redirect_canonical’ ); That will deactivate the redirections, all of them.

Localhost wordpress site redirects to public site

WordPress will try to redirect you to the canonical URL for the site, as set in the database during the initial install. But you can override it in the wp-config.php file by setting the WP_HOME constant: http://codex.wordpress.org/Editing_wp-config.php#Blog_address_.28URL.29 If WP is installed in a subdirectory, you might also need to set WP_SITEURL.

Redirect not logged in users if they are on a specific page

Your function is fine, but ‘get_header’ it’s too late. Use template_redirect instead: add_action( ‘template_redirect’, function() { if ( is_user_logged_in() || ! is_page() ) return; $restricted = array( 250, 253 ); // all your restricted pages if ( in_array( get_queried_object_id(), $restricted ) ) { wp_redirect( site_url( ‘/user-registration’ ) ); exit(); } }); Be sure to not … Read more

301 Redirect Loop

I think there is some issue with openshift’s php hosting. I found this thread on stackoverflow. So catch is you append port no after host. This .htaccess code should work. RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule (.*) http://www.example.com:80/$1 [R=301,L]

How do I redirect /search/ to ?s=

In your .htaccess add the following rule in between the <IfModule mod_rewrite.c> tag: RewriteCond %{QUERY_STRING} (^|&)(.*) RewriteRule ^(.*)$ /?s=%2 [R=301,L] Based off of the default .htaccess generated by WordPress, it should now look like the following with your custom RewriteRule: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} … Read more

Redirect all pages except one to homepage via .htaccess

Problems I get too many redirect: all urls redirect infinitely to themselves, why? Apache rewrite rules are processed top-to-bottom, so your custom rewrite rule is always processed first. The R redirect flag instructs Apache to tell the browser to make a new request to the altered URL instead of serving the destination of the rewrite … Read more