我正在尝试使用.htaccess文件重写URL规则 . 这似乎在我的主.htaccess文件中工作正常(仅适用于存在于同一目录中的php页面),但是当我想在子目录中使用另一个.htaccess for php文件时,规则根本不适用404错误页面 .
我想指向的文件是/news/story.php . story.php请求一个名为'article'的整数变量来从数据库中获取文章并显示它 . 基本上我想做的是用http://www.mydomain.com/news/story/article/1/替换http://www.mydomain.com/news/story.php?article=1
我在'news'目录中的.htaccess文件中使用以下规则 .
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteRule story/article/(.*)/ story.php?article=$1
RewriteRule story/article/(.*) story.php?article=$1
谢谢你的帮助
1 回答