There are multiple options available to handle redirects in wordpress. A redirect is a way to tell the users and search engines that a page have moved to a new location. The move can be temporary or permanent. For permanent move “HTTP 301” header is used by web servers. Here is a example using HTTP live headers Firefox plugin:
In this example a url
http://infoheap.com/category/hosting/ is being redirected to
http://infoheap.com/tag/hosting/. This is the response which tells browsers or search engine crawlers/bots that the page have moved permanently:
HTTP/1.1 301 Moved Permanently Location: http://infoheap.com/tag/hosting/
There are multiple ways to handle permanent redirects in wordpress:
- When a post or page is renamed, wordpress automatically generate the redirect header as it stores old urls in revisions. So you dont have to do anything. But if you clean the old revisions data regularly (I use wp-optimize to clear old revisions regularly) for performance reasons, this may not work.
- Using some redirection plugin. I have tried Redirection plugin and this seems to be one of the best plugin for handling redirection. You specify source and destination url and it takes care of redirection for you. It also generates reports on how many redirects happened, etc. In addition it provides 404 reports also for “page not found” errors.
I would strongly recommend this plug to handle redirects.
- One more option is to use apache RedirectRule in apache configuration as show.
RewriteEngine On RewriteRule ^/category/technology/hosting/ http://infoheap.com/tag/hosting/ [L,R=301]
This uses apache mod_rewrite extension. Now why would you use apache configuration option when more user friendly options are available? Using apache is usually faster as it happens much before php scripts are loaded and there is no database query and update. So in cases where there are many hits on some specific urls, you may want to consider this option.