【发布时间】:2017-06-06 22:52:27
【问题描述】:
我有一个 html 网页,在网站的徽标上,我将我的徽标 URL 写为
example.com 我现在想将所有发往example.com 的请求重定向到http://www.example.com
到目前为止,这是我的.htaccess:
ErrorDocument 404 http://www.example.com/404.html
Redirect /index.html http://www.example.com
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]
example.com 没有被重定向到http://www.example.com。
【问题讨论】:
-
我认为你需要在重写规则
^(.*)$中添加一个^否则你不知道你在匹配什么。