【发布时间】:2016-08-23 01:53:39
【问题描述】:
我想使用 htaccess 将所有 .php 脚本重定向到 index.php。 /assets/ 文件夹中的脚本除外。
例如:
/test.php -> /index.php
/folder/test.php -> /index.php
/assets/test.php -> /assets/test.php
/assets/folder/folder/test.php -> /assets/folder/folder/test.php
这是我当前的 htaccess 文件:
RewriteEngine on
RewriteCond %{REQUEST_URI} !(\.png|\.jpg|\.gif|\.jpeg|\.bmp|\.css|\.js|\.woff|\.woff2|\.map|\.ico|\.map)$
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
【问题讨论】: