.htaccess 重写以重定向到/app/web/path1/path2[etc]到/app/web/index.php/path1/path2[etc]

.htaccess 重写以重定向到/app/web/path1/path2[etc]到/app/web/index.php/path1/path2[etc],.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我正在尝试创建一个重写规则,该规则允许: /app/web/morepath/morepath2重写为/app/web/index.php/morepath/morepath2(如果提供更多路径项) 我不希望浏览器中的URL反映更改的路径(在/app/web之后插入index.php) 如果您有任何建议,请告诉我。在文档根目录中,尝试: RewriteEngine On RewriteCond %{THE_REQUEST} \ /+app/web/index\.php/?([^\?\ ]*)

我正在尝试创建一个重写规则,该规则允许:

/app/web/morepath/morepath2重写为/app/web/index.php/morepath/morepath2(如果提供更多路径项)

我不希望浏览器中的URL反映更改的路径(在/app/web之后插入index.php)


如果您有任何建议,请告诉我。

在文档根目录中,尝试:

RewriteEngine On

RewriteCond %{THE_REQUEST} \ /+app/web/index\.php/?([^\?\ ]*)
RewriteRule ^ /%1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^index\.php
RewriteRule ^app/web/(.*) /app/web/index.php/$1 [L]

很好用!!非常感谢。