0
我一直在試圖找到除少數所有目錄重定向到一個文件具有可變的.htaccess重定向所有子目錄到文件
的方法。例如:
site.com/test -> index.php?a=test
我想所有子目錄轉發除了以下
/images
/admin
/includes
我已經嘗試了以下成功。
RewriteCond %{REQUEST_URI} !^/images(/|$)
RewriteCond %{REQUEST_URI} !^/admin(/|$)
RewriteCond %{REQUEST_URI} !^/includes(/|$)
RewriteRule ^([\w/]*)$ index.php/?a=$1 [L]
有沒有辦法使用的.htaccess
編輯來完成這一點:
我發現這是更接近它需要更新什麼即時尋找,但允許訪問/圖片/ admin/includes。
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?a=$1 [NC,L,R=301]
我不明白這是如何回答我的OP在所有 –
它更容易管理目錄添加另一個.htaccess文件與RewriteEngine敘述** **關閉或包括 - 將被這條規則被忽略! –