我有一个带有Codeigniter网站的客户端,并且设置它以便网站上的网页有这样的网址:
http://www.domain.com/shop/page/pagename
因为这是一个Codeigniter网站被重写为:
http://www.domain.com/index.php?/shop/page/pagename
我的客户希望某个特定页面有这样的网址:
http://www.domain.com/specialpage
所以我想我可以像我这样在我的htaccess中添加一个RewriteRule:
RewriteBase /
# The new rule
RewriteCond %{REQUEST_URI} ^/specialpage$
RewriteRule ^(.*)$ index.php?/shop/page/specialpage [PT,L]
# The usual Codeigniter rewrite rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [PT,L]
但是当我尝试浏览/specialpage
时,我得到了404。我错过了什么?
我也尝试了以下RewriteRules,结果相同:
RewriteRule ^/?specialpage$ /shop/page/specialpage [L,NC]
RewriteRule ^/?specialpage$ index.php?/shop/page/specialpage [L,NC]
RewriteRule ^/?specialpage$ index.php/shop/page/specialpage [L,NC]