301 Redirect Example

301 Redirect Example

301 Redirects are used to help maintain page rank after switching to a new domain or making changes to website titles. They can be easily setup by making use of the .htaccess file (Learn how to setup Aptana to modify .htaccess files).

redirect 301 /page.html http://www.website.com/page

Using the below code you can redirect search engines to a standard URL format. The problem occurs when users are able to access your site using different domains e.g. with or without the www. prefix.

#Canonical Fixes
RewriteRule ^home(.*)$ / [R=301,L]

#Rewrite WWW
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]



Leave a Reply

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


-->