我一直在尝试这一段时间。我想将例如wwww.example.com重定向到exmaple.com。.htaccess将www重定向到非www网页
我试过的代码片段几个:
RewriteCond %{http_host} ^dansams\.co.uk [nc]
RewriteRule ^(.*)$ http://www.dansams.co.uk/$1 [R=permanent,nc,L]
....
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
还有更多,但没有工作过。我的根目录中有.htaccess文件,名为'public_html'。我的所有网站内容都在该public_html文件夹中。当我尝试的代码所有这些不同的片段发生了什么事时,当我尝试www.example.com,它越来越采取的网址:
www.example.com/public_html
该页面显示一些内容,但没有三网融合和它也不是所有的索引内容。
任何与此有关的帮助将不胜感激。
在此先感谢
什么是你的DocumentRoot? – anubhava 2014-10-11 03:45:44