Redirecting traffic from one URL to another is a common task among webmaster. It’s usually done so when old pages are renamed/moved and you want to redirect people to the new page instead of letting them get a 404 no page found error. Affiliate marketers also do this intentionally to cloak their links and redirect users to the real link which hold their tracking id or affiliate credentials.
For example, you might want to redirect people landing on mysite.com/old.html to mysite.com/new.html.
The simplest way is to chuck some “magical” code into your .htaccess file.
Redirect 301 /old.html /new.html
301 is for a permanent redirect while you can also choose 302 or 307 if you require a temporary redirect. When it comes to redirecting URL, the http status codes 301, 302 and 307 is all you’ll need.
If you use WordPress like I do for this blog, there’s an awesome plugin which can help you with setting up redirections known as, well, Redirection.
Shown below is what I’m currently using it to redirect people to buy a book on Amazon.
Leave a Reply