htAccess重定向除资产文件夹以外的所有.php

问题描述:

我想用htaccess将所有.php脚本重定向到index.php。除了/ assets /文件夹内的脚本外。htAccess重定向除资产文件夹以外的所有.php

例如:

/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] 

找到了答案......

添加此为.htaccess:

的RewriteCond% {REQUEST_URI}!^(/ assets)