How to setup a 301 redirect

301-redirectA 301 redirect is the most efficient and spider/visitor friendly strategy available for web sites that are hosted on servers running Apache / Linux

It’s not hard to implement and it should preserve your search engine rankings for that particular page. If you *have* to change file names or move pages around, it’s the safest option.

A 301 redirect is implemented in your .htaccess file.

PHP Method:

header("HTTP/1.1 301 Moved Permanently");

.htaccess Method:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

Thats it.

Published by Janes Oosthuizen

Programmer and Tech Junky from Bloemfontein, South-Africa. I have been programming for 8 years in various languages including ( CSS, HTML, jQuery, PHP, MySQL, Wordpress and many other ).

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *