Apache .htaccess 301 Redirects

Creating search engine friendly 301 redirects as part of your SEO initiatives is a great tip to keep under your belt.

If your website server uses Apache .htaccess, generating the redirect from the config is probably your easiest and most efficient solution.

Search engines interpret the 301 code as meaning "moved permanently". In turn, PageRank/trust is passed from the old page to the new.

ShareThis

Example Code

Redirecting a Domain

Options +FollowSymlinks
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]

Redirecting a Page

RedirectMatch 301 ^/old-page.html$ http://www.domain.com/new-page.html

This code is placed in the .htaccess file on your server.


blog comments powered by Disqus



Friends