Redirects for WordPress

By John Balnaves, Developer

Below is how the flow of your .htaccess should look for Wordpress. The redirects should be at the top of you htaccess file before any of the WordPress junk. More specific URLs come first and filter down to the less specific :

#redirects
Redirect 301 /old-example/example http://examplesite.com/new-example/example
Redirect 301 /old-example/ http://examplesite.com/new-example/
Redirect 301 /old-example/ http://examplesite.com/

#wordpress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Redirects for WordPress query string. Use this the url generated on the old site is a http://example.com/?food=toast and you want to redirect this to http://example.com/food/toast on the new site:

#Redirect for old query structure
RewriteCond %{QUERY_STRING} food=toast
RewriteRule ^(.*)$ /food/toast/? [R=301,L]

 

About north street

We engineer the thoughtful transformation of great organizations. Our proven process helps us understand what your competitors are doing right — and wrong. Want to learn more? Let’s chat.

More Notes

A bowler hat with radio waves behind it

From Layoff to Leadership: Tom Conlon’s Journey to a Prosperous Business

Welcome to Your 2024 Branding Pep Talk

A bowler hat with radio waves behind it

CEO Tom Conlon talks shop on Podcast Marketing Secrets