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

Photo of Tom Conlon

CEO Tom Conlon in Conversation with Chris White

Designing for Interaction: How Animated Prototypes Revolutionize Website Development

man with arms folded in front of blue city background

Team Spotlight: Cristian Sánchez, Lead Developer