Admin Life Errors, Fixes, and Encounters

18Jan/101

domain redirect .htaccess

To redirect one domain to another or even to redirect a domain to add www at the beginning of website address you'll need to do a few things.

1) Create an .htaccess file in the main directory of the website (document root)

2) add the following code inside .htaccess and change line 3 and 4.
line 3: current domain(website) to find
line 4: redirect domain(website)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

That's it! If it doesn't work make sure in your httpd.conf (apache only) that AllowOverride is set to "AllowOverride ALL" and not "AllowOverride None"

Here's a sample

AllowOverride ALL

That can also be put inside for domain specific settings.

Comments (1) Trackbacks (0)
  1. A fascinating discussion is definitely worth comment. I believe that you should write more on this subject, it may not be a taboo subject but usually people do
    not talk about these topics. To the next! Many thanks!!


Leave a comment

No trackbacks yet.