我有htaccess文件问题。我认为我的htaccess文件存在冲突。
我的.htaccess文件:
RewriteEngine on
RewriteRule ^(.*)/video/ video.php?vid=$1 [L]
RewriteRule ^search/(.*)\.html search.php?q=$1 [L]
RewriteRule sitemap-(.*).xml sitemap.php?sayfa=$1 [L]
和我的网址
搜索:http://www.domain.com/search/search_query.html
视频播放:http://www.domain.com/path1/video/video_name.html
.htaccess文件冲突video.php和search.php
请帮帮我
答案 0 :(得分:0)
尝试使用否定前瞻来防止这两个规则相互适用:
RewriteEngine on
RewriteRule ^(?!search)(.*)/video/ video.php?vid=$1 [L]
RewriteRule ^search/(?!video)(.*)\.html search.php?q=$1 [L]
答案 1 :(得分:0)
更改规则的顺序,以便先保留特定规则,然后再保留常规规则:
RewriteEngine on
RewriteRule ^search/(.*)\.html$ search.php?q=$1 [L]
RewriteRule sitemap-(.*).xml$ sitemap.php?sayfa=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/video/ video.php?vid=$1 [L,NC]