老實說,我是 htaccess 的新手,我的問題是當我想訪問鏈接時,在使用帶有變數的 htaccess rewriterule 時,它??給了我一個 404 錯誤,因為它想訪問變數作為檔案而不是在 htaccess 中給出一個:
鏈接如下所示:example.com/folder/variable
在 htaccess 中它看起來像這樣:
RewriteEngine on
Options -Indexes -MultiViews
Order Allow,Deny
Allow from all
Satisfy any
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^folder/([0-9a-z-A-Z-_] )/$ folder/file.php?title=$1 [NC,QSA,L]
理論上它應該有效,因為它有效,但對我來說它沒有。我試圖重寫這段代碼“幾次”,為其他人使用了很多作業代碼,使我的作業沒有任何運氣。在我的 httdp.conf 檔案中,我將 AllowOverride None 更改為 AllowOverride All,我還檢查了 rewrite_module 是否處于活動狀態,并且它在沒有變數的情況下完美運行。還有一個 htaccess 檔案,可以滿足我檔案夾中的任何代碼。
我希望我(我們)可以解決我代碼中的這個錯誤。感謝您未來的幫助和您的時間!
uj5u.com熱心網友回復:
發現錯誤,這里是正確的行( / 之前 $ 使它不起作用):
RewriteRule ^folder/([0-9a-z-A-Z-_] )$ folder/file.php?title=$1 [NC,QSA,L]
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/398111.html
