【发布时间】:2011-09-30 22:27:19
【问题描述】:
我在我的 Web 服务器上的 htaccess 文件中写入 rewritecond 时遇到问题。如果有人可以帮助我,那对我很有帮助。
我想要完成的是这两件事: 1.将所有对http://domain.com的请求重定向到http://www.domain.com 2. 如果存在,则从 URL 中重定向/删除 index.html 部分。
我当前的 htaccess 设置是:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^example.com [nc]
RewriteRule ^(.*)$ http ://www. example. com/$1 [R=301,NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ [b]http :// www. example. com[/b]/$1 [R=301,L]
发生的情况是,当 URL 包含 index.html 时,它基本上给出了 404 页面。不确定重定向在哪里循环。有人插话以阐明这个问题吗?
提前致谢。
【问题讨论】:
标签: apache .htaccess redirect web webserver