简体   繁体   English

.htaccess重写规则与其他文件冲突

[英].htaccess Rewrite rule conflict with other file

i have made a .htaccess file but a problem occurs is that conflicting 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

when i open www.example.com/f9/1 its open perfectly , but when i open www.example.com/f10/1 or www.example.com/f11/1 it shows another page which is in my htaccess file just like f13/1, how can i prevent this conflicting and open correct page 当我打开www.example.com/f9/1时,它完全打开,但是当我打开www.example.com/f10/1或www.example.com/f11/1时,它显示另一个页面,该页面仅在我的htaccess文件中像f13 / 1一样,如何防止这种冲突并打开正确的页面

Try your code this way. 尝试这种方式的代码。

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