2016-04-28 96 views
1

我想用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] 

回答

0

找到了答案......

添加此爲.htaccess:

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

相關問題