簡體   English   中英

.htaccess重寫規則與其他文件沖突

[英].htaccess Rewrite rule conflict with other file

我已經制作了一個.htaccess文件,但發生的問題是與其他文件沖突

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f9/([^/\.]+)?$ footer_arts.php?page=$1 [QSA,L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f10/([^/\.]+)?$     footer_bus.php?page=$1 [QSA,L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f11/([^/\.]+)?$     footer_cely.php?page=$1 [QSA,L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f12/([^/\.]+)?$     footer_com.php?page=$1 [QSA,L]

RewriteRule ^f13/([0-9]+)$     footer_edu.php?page=$1

當我打開www.example.com/f9/1時,它完全打開,但是當我打開www.example.com/f10/1或www.example.com/f11/1時,它顯示另一個頁面,該頁面僅在我的htaccess文件中像f13 / 1一樣,如何防止這種沖突並打開正確的頁面

嘗試這種方式的代碼。

RewriteEngine On
#if the request is a real file or directory, do nothing otherwise process one of the rules below.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^f9/([^/]+)/?$ footer_arts.php?page=$1 [QSA,L]
RewriteRule ^f10/([^/]+)/?$ footer_bus.php?page=$1 [QSA,L]
RewriteRule ^f11/([^/]+)/?$ footer_cely.php?page=$1 [QSA,L]
RewriteRule ^f12/([^/]+)/?$ footer_com.php?page=$1 [QSA,L]
RewriteRule ^f13/([0-9]+)/?$ footer_edu.php?page=$1 [QSA,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM