【发布时间】:2013-12-31 22:17:57
【问题描述】:
我有一个 htaccess 设置,已经重写所有对 index.php 的请求。但现在我有一个条件,我想重写(我不知道该怎么做或选择哪个)a subfolder /admin to index.php?route=admin/login,是的准确的网址
期待
www.domain.com/admin
改写为
www.domain.com/index.php?route=admin/login
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/install(.*)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
#########################################
##I expect the line below will go to the url , but when i enter the subfolder , the page remain at the index
RewriteRule ^admin/(.*)$ /$1?route=admin/login [R=301,L]
【问题讨论】:
-
/admin/文件夹中有任何 .htaccess 吗? -
@anubhava 是的,我可以拥有
标签: php regex apache .htaccess mod-rewrite