.htaccess Remove WWW from URL + Directories

后端 未结 6 710
一整个雨季
一整个雨季 2020-11-29 20:31

This seems to be a non-issue for many people (read: I can\'t find an answer), but I would like to update the following htaccess code to not only remove the \'www\' from the

6条回答
  •  [愿得一人]
    2020-11-29 20:55

    I think you're close, but try the following:

    # force non-www domain
    RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
    RewriteRule (.*) http://example.com/$1 [R=301,L]
    

    Not sure exactly what you mean about sub-directories, but this follows your example.

提交回复
热议问题