Redirect to

Many times we meet with a situation where we need to redirect root domains to www. With apache htaccess file you can put the following rule in .htaccess file of webroot directory of your domain

  • cd /path/to/webroot
  • vim .htaccess
  • Add the following code

# Enable Rewrite Engine

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mylinuxtips\.info
RewriteRule ^(.*)$$1 [R=permanent,L]

NOTE: You must have your mod rewrite enabled to achieve this redirection.


Leave a Reply

Your email address will not be published. Required fields are marked *