[英]Mod_Rewrite: Rewrite Rules confilicting with each other
我想将mydomain.com主页重定向到mydomain.com/index.php?cat=home
这是我的htacess文件规则:
RewriteRule index.php index.php?cat=home [L]
RewriteRule (.*)-live-streaming-online.html index.php?cat=$1 [L]
当两者都处于活动状态时,无论我的猫如何重定向到index.php?cat = home
这个动作有什么问题?
在DOCUMENT_ROOT/.htaccess
文件中保存如下规则:
RewriteEngine On
RewriteRule ^(.+?)-live-streaming-online\.html$ /index.php?cat=$1 [NC,L,QSA]
RewriteCond %{THE_REQUEST} \s/+(index\.php)?[\s/?] [NC]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^ /index.php?cat=home [L]
关键是使用%{THE_REQUEST}
,它代表Apache收到的原始请求。 RewriteRule
其他使用URI模式的对象可以根据您的其他规则进行更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.