本文介绍了使用的RewriteCond与重写规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我EM有趣的将是更好,因为我把:

 的RewriteCond%{HTTP_USER_AGENT}!(SAFA |导航器)[NC]
重写规则^ drugi /(.*)$ /index.html [L,NC]
重写规则^ TRECI /(.*)$ /index.html [L,NC]
 

或者我得把的RewriteCond每个单独重写规则如下图所示:

 的RewriteCond%{HTTP_USER_AGENT}!(SAFA |导航器)[NC]
重写规则^ drugi /(.*)$ /index.html [L,NC]

的RewriteCond%{HTTP_USER_AGENT}!(SAFA |导航器)[NC]
重写规则^ TRECI /(.*)$ /index.html [L,NC]
 

解决方案

的RewriteCond 只适用于第二天重写规则因此,你的第一个code是不正确的。但还有更好的方法来使用正则表达式的2规则组合成一个 |

 的RewriteCond%{HTTP_USER_AGENT}!(SAFA |导航器)[NC]
重写规则^ |(。*)(drugi TRECI)/ $ /index.html [L,NC]
 

I em interesting will It be better as I put:

RewriteCond %{HTTP_USER_AGENT} !(safa|navigator) [NC]
RewriteRule ^drugi/(.*)$ /index.html [L,NC]
RewriteRule ^treci/(.*)$ /index.html [L,NC] 

Or I have to put RewriteCond for each RewriteRule separate like below:

RewriteCond %{HTTP_USER_AGENT} !(safa|navigator) [NC]
RewriteRule ^drugi/(.*)$ /index.html [L,NC]

RewriteCond %{HTTP_USER_AGENT} !(safa|navigator) [NC]    
RewriteRule ^treci/(.*)$ /index.html [L,NC]  
解决方案

RewriteCond is only applicable to the very next RewriteRule therefore your first code is not right. But there is better way to combine those 2 rules into one using regex |:

RewriteCond %{HTTP_USER_AGENT} !(safa|navigator) [NC]
RewriteRule ^(drugi|treci)/(.*)$ /index.html [L,NC]

这篇关于使用的RewriteCond与重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:46