Redirect non-www to www in .htaccess

后端 未结 13 1714
轻奢々
轻奢々 2020-11-22 05:51

I have this in my .htaccess file:

RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com$1 [R=301,L]

but whenever I

相关标签:
13条回答
  • 2020-11-22 06:36
    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
    

    This will redirect your domain which is not started with WWW It is not redirect your all sub domain.

    It is useful.

    0 讨论(0)
提交回复
热议问题