如何在rewritecsecond中获取本地路径



这是我的。htaccess文件:

RewriteEngine On
RewriteBase /projs/CodeIgniterTest
RewriteCond %{REQUEST_URI} !^/projs/CodeIgniterTest/index.php
RewriteRule ^(.*)$ index.php/$0

RewriteRule工作正常,但我无法让RewriteCond行与本地路径一起工作。我想让它工作:

RewriteCond %{REQUEST_URI} !^index.php

但是,唉,%{REQUEST_URI}不太关心RewriteBase行,而是使用全路径。有什么方法可以达到我想要的结果吗?我不想每次更改项目路径时都要编辑。htaccess文件。

RewriteRule ^index.php - [L]
RewriteRule ^(.*)$ index.php/$0

还是

RewriteCond $0 !^index.php
RewriteRule ^(.*)$ index.php/$0

最新更新