开发者

Problem with getting to the second rewrite rule: is the first too general?

as i describe already above if i call e.g. /berlin it properly routes, but if i try /berlin-blabla-50-prozent-rabatt.html it also takes the first rule,i'm not sure how to negate the regex telling if it has "-" or something like that take the second. I also got a problem, if i put a trailing / it also breaks, do i have to add a third rule to cover the trailing /? Every help appreciated!

RewriteRule ^(.*)$ /dev/index.html?city=开发者_如何学C$1 [NC,R]
RewriteRule ^(.*)-(.*)-50-prozent-rabatt.html$ /dev/index.html?city=$1&deal=$2 [NC,L,R]

Thanks in advance!


The first rule catches everyting, so it will never go on to any other rules.

Switch places on the rules. A rule that catches everything always has to be last.


this worked out for me at the end:

RewriteRule ^(.{1,15})$ index.html?city=$1 [NC]
RewriteRule ^(.*)-(.*)-(.*)-prozent-rabatt.html$ index.html?city=$1&deal=$2 [NC,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜