我有以下結構
- .htaccess
- cms
- other_cms
-- xyz
在.htaccess我有很多我想忽略的重寫規則/other_cms。
我在 .htaccess 之上添加了以下內容
RewriteEngine On
RewriteRule ^other_cms/ - [L]
RewriteRule ^other_cms/test/ - [L]
RewriteRule ^other_cms(/.*)?$ - [L,NC]
RewriteCond %{REQUEST_URI} ^other_cms/(.*)$
RewriteRule ^.*$ - [L]
我的目標是/other_cms(無論它是否真的存在)的每個子目錄及其/other_cms本身都被.htaccess根中的這個檔案忽略。
我還嘗試為每個規則添加一個條件:
RewriteCond %{REQUEST_URI} !^other_cms(/.*|)$
當我打開/other_cms/test它時,它仍然呼叫所有規則并/cms應用 404。
我已經添加了一個 .htaccess 檔案來/other_cms包含RewriteEngine Off,但我想這永遠不會被讀取。
我究竟做錯了什么?
uj5u.com熱心網友回復:
我在根 .htaccess 檔案中使用以下內容解決了它:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^other_cms/(. )$ /other_cms/index.html?u=$1 [NC,QSA,L]
我洗掉了檔案other_cms/夾中的 .htaccess 檔案。
這確保它使用index.html我的子檔案夾的檔案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/478249.html
