【发布时间】:2014-04-28 13:25:13
【问题描述】:
我正在使用这个.htaccess,里面有这个:
DirectoryIndex index.php index.html
DirectorySlash On
Options -Indexes
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/(page1|page2|page3)$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
#Show every html,htm and xml as php
RewriteRule ^(.*)\.html$ $1.php [nc]
RewriteRule ^(.*)\.htm$ $1.php [nc]
RewriteRule ^(.*)\.xml$ $1.php [nc]
但我没有将 http://example.com/page1 重定向到 -> http://example.com/page1/ (以及其他 page2 和 page3 )。因为我在本地进行了测试,所以我的网址将是 本地主机/示例/page1 并且应该重定向到 本地主机/示例/page1/ 有没有人觉得有什么问题?
【问题讨论】:
标签: regex apache .htaccess mod-rewrite