繁体   English   中英

URL将子文件夹中的所有php文件重写为index.php

[英]URL rewrite all php files in subfolder to index.php

我正在尝试建立一种将子文件夹中的所有php文件重写为index.php的方法

到目前为止,我一直在尝试:

RewriteEngine on

RewriteBase /simple

RewriteRule ^(.+)/$ index.php

它不能100%正常工作,现在也需要CSS,IMG和所有其他文件(不应该),仅PHP文件。

希望能有所帮助。 谢谢。

您可以使用:

DirectoryIndex index.php
RewriteEngine on
RewriteBase /simple/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

或以下规则:

RewriteRule !\.(js|ico|gif|jpe?g|png|css|html|swf|flv|xml)$ index.php [L,NC]

RewriteRule ^(.+)\\.php$ index.php是方法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM