How to Quickly 301 pages in WordPress

by Paul Wilson

 

Lately, I have been getting a lot of requests on how to 301 pages in WordPress. It is actually a really simple process, but a step that makes it even easier is using a plugin titled, WP htaccess Control.

This plugin makes optimizing your .htaccess file very easy, and therefore, I have added it to my “meat and potato” plugins I use to setup every blog with. I will have to write another post on what all the features are, but in short this plugin gives you access to your .htaccess file via your WordPress admin dashboard.

To setup a 301 with the WP htaccess Control plugin, you need to go to the plugin admin (titled WP htaControl). Here go to the third menu (custom htaccess) and enter the following code (be sure to change the structure and domain for your circumstances:

redirect 301 /old/old_page/ http://www.example.com/new_page/

This bit of code will help you 301 individual pages quite quickly and easily.

A while ago I had a website with 500 plus pages of content on it. Unfortunately, the domain name of this website was really a horrible name for the niche. I lived with the domain name for years, but finally I could not take it any more and bought a desirable domain name that fit the niche a thousand times better.

I exported the old content from the undesirable domain and imported it to the new domain via the WordPress export/import function. This gave my new site the exact same structure of my old site. I was worried that I was going to have to 301 each and every page of the website, but when I reached out to an amazing PHP friend of mine he gave me the below code. This code 301s all content from one website to a website but it needs to have identical website structure (which was exactly the situation for me).

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

This rewrite rules will redirect the root + all permalinks from old the domain to the new domain. Again, be sure to have exactly the same permalinks for all your resources on both domains.

Once implemented, it is easy to check your redirect rules and status codes at web-sniffer.net.

Hope this is helpful! ~Paul

Related Posts: