Saturday, April 25, 2009

Domain Redirecting using mod_rewrite

For some reason you need to redirect your domain you can do so by using following code and need to update .htaccess file.
To redirect domain to www. domain you need to put the following mod_rewrite rule in .htaccess file inside public_html.

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

To use this rule mod_rewrite module is needed on server.

Note - Replace domain.com with your actual domain name.

0 comments:

Post a Comment

  © Blogger template PingooIgloo by Ourblogtemplates.com 2009

Back to TOP