【发布时间】:2014-11-20 10:49:50
【问题描述】:
我一直在研究各种 .htaccess 教程和指南,以将我的动态 URL 转换为平面 SEO 友好的 URL。
一切正常,除了一个链接,它似乎恢复为动态 URL。我尝试禁用一些规则,但似乎无法解决问题。
重定向示例
http://iforwms.com/page/home => http://iforwms.com/index.php?page=home(没问题)
http://iforwms.com/page/blog => http://iforwms.com/index.php/blog?page=blog (??)
这是我的整个 .htaccess 文件。希望有人能对此有所了解...
# Set Timezone
SetEnv TZ Asia/Shanghai
Options +FollowSymLinks
# Enable Rewriting
RewriteEngine on
# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} ^www\.iforwms\.com$ [NC]
RewriteRule ^(.*)$ http://iforwms.com/$1 [R=301,NC,L]
# Rewrite user URLs
RewriteRule ^page/(\w+)$ index.php?page=$1 [L]
# Retrieve tagged blog posts
RewriteRule ^page/blog/(\w+)$ index.php?page=blog&tag=$1 [L]
# Retrieve single blog post
RewriteRule ^page/article/(.*)/(.*)$ index.php?page=blog&article=$2 [L]
提前致谢,
-ifor
【问题讨论】:
-
你在
/blog/中也有一个.htaccess 吗?
标签: php apache .htaccess mod-rewrite