上查询:重写规则对别名URL
domain.com/page/do
我需要:
domain.com/index.php/page/do
等
我使用htaccess的文件,我添加别名
RewriteBase /index.php/
我如何写RewriteRule到这个URL?
上查询:重写规则对别名URL
domain.com/page/do
我需要:
domain.com/index.php/page/do
等
我使用htaccess的文件,我添加别名
RewriteBase /index.php/
我如何写RewriteRule到这个URL?
试试这个:
RewriteRule ^(.*)/(.*)$ /$1/$2 [L]
添加这些规则的htaccess文件你的文档根:
RewriteEngine On
RewriteBase/
RewriteCond ^/index.php
RewriteRule ^/?(.*)$ /index.php/$1 [L]
试试这个,它应该做你想要什么,并消除需要有指标.php in your uri
###
# Rewrite Rules
#
<IfModule mod_rewrite.c>
### Enable mod_rewrite
RewriteEngine On
RewriteBase/
### Checks if the URI request path coincides with a literal path
### on the filesystem relative to the webroot. If it does not exist,
### then it passes the path through index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
这是一个通用的重写规则。有关示例,请参阅[其他问题](http://stackoverflow.com/a/265934/150634)。 –