domain.com to www.domain.com (mod_rewrite rule)

domain.com to www.domain.com (mod_rewrite rule)

For redirecting domain.com to www.domain.com you need to made folllowing changes in your .htaccess file.

For this changes make sure that mod_rewrite module is available on your server .
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

Note: please replace domain.com with your domain name.

Sharing

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.