Codes to Implement Search Engine Friendly Redirects on PHP / Apache Server

Filed Under (PHP, Web Development) by admin on 04-09-2008

Redirecting Non www URL’s to www version

For .com domains

RewriteCond %{HTTP_HOST} ^.*abc.com$
RewriteRule (.*) http://www.abc.com/$1 [R=301,L]

For domains with regional TLD

RewriteCond %{HTTP_HOST} ^.*abc\.co\.uk$
RewriteRule (.*) http://www.abc.com/$1 [R=301,L]

Redirecting index page to absolute Path

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.abc.com/ [R=301]

The above mentioned code are tried and tested and are completely in compliance with search engine standards (301 Permanent Redirect).

Post a comment

Video