How To Redirect To www Using .htaccess?

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • John_Accuwebhosting
    Senior Member
    • Jun 2006
    • 120

    How To Redirect To www Using .htaccess?

    You may be in a need to redirect all requests coming to your domain name domain.com to www.domain.com. For Linux based hosting, you can write following redirect rule in .htaccess file. Please make sure that Apache Mod-Rewrite module should be enabled in Linux server to make this working :

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

    Note: Make sure you replace domain.com and www.domain.com with your actual domain name.

    Accuwebhosting.com
    Last edited by admin; 07-24-2015, 10:29 AM.
    John D.
    Support Technician,
    accuwebhosting.com
    Windows based hosting
    Linux based hosting
Working...
X