301 Redirect for Apache Guide

Write to file called ‘.htaccess’. The file is named only as an extension. Hidden files must be viewable in operating system. mod_rewrite must be enabled

Redirect single file or directory to a new file or directory on a different domain
Redirect 301 /oldpage.html http://www.newdomain.com/ newpage.html

Redirect http://mysite.com to http://www.mysite.com. Affects entire domain

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

Redirect entire domain to a new domain as either a 301 (recommended) or 302
Entire site:
Redirect 301 / http://www.newdomain.com/
Redirect permanent /old http://www.newdomain.com/new

This entry was posted in SEO Tips. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>