web hosting reviews


301 Permanent redirects for parked domain names

Web Hosting Articles \ A simple guide to .htaccess \ 301 Permanent redirects for parked domain names


If you have several domain names parked/pointed at your site it is a good idea to create permanent 301 redirect for them so for the search engines not to treat them as duplicate content.

Here is a sample .htaccess that will do that:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^parkeddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^parkeddomain-2.com$
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301]

And even more generic solution would be:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.maindomain.com$
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301]

  1. How to block users from accessing your site based on their IP address
  2. How to prevent or allow directory listing?
  3. How to change the error documents – 404 Page Not Found, etc
  4. Using .htaccess for password protecting your folders
  5. Using .htaccess to block referrer spam
  6. Disable Hot-Linking of images and other files
  7. Redirect URLs using .htaccess
  8. Introduction to mod_rewrite and some basic examples
  9. Force SSL/https using .htaccess and mod_rewrite
  10. 301 Permanent redirects for parked domain names
  11. Enable CGI, SSI with .htaccess
  12. How to add Mime-Types using .htaccess
  13. Change default directory page
  14. Block Bad robots, spiders, crawlers and harvesters
  15. Make PHP to work in your HTML files with .htacess
  16. Change PHP variables using .htaccess
  17. HTTP Authentication with PHP running as CGI/SuExec
  18. Force www vs non-www to avoid duplicate content on Google
  19. Duplicate content fix index.html vs / (slash only)

Comments 1 >>

Volunteer Abroad Said,
Apr 15, 2008 @ 05:39

Thanks - this helped me loads!
Your comments on this article

(required)

(required but never displayed)



security code



Previous: Force SSL/https using .htaccess and mod_rewrite Next: Enable CGI, SSI with .htaccess

Back to Web Hosting Articles list

Web hosting companies A-Z:
All web hosting companies


About - Terms of Use - Privacy Policy -
Web Hosting Reviews