开发者

mod_rewrite rules problem

开发者 https://www.devze.com 2023-02-17 23:10 出处:网络
I have开发者_StackOverflow中文版 two simple mod rewrite rules RewriteRule club/(.*)-(.*).html$ club.php?id=$2&%{QUERY_STRING}

I have开发者_StackOverflow中文版 two simple mod rewrite rules

RewriteRule club/(.*)-(.*).html$ club.php?id=$2&%{QUERY_STRING}
RewriteRule club/details/(.*)-(.*).html$ /club/details.php?id=$2&%{QUERY_STRING}

The first one works, but the second dosent. I think the first override the second but I can`t figure out how to fix it


RewriteRule club/(.*)-(.*).html$ club.php?id=$2&%{QUERY_STRING} [L]
RewriteRule club/details/(.*)-(.*).html$ /club/details.php?id=$2&%{QUERY_STRING}

Try with that.


try

RewriteRule club/(.*)-(.*).html$ club.php?id=$2 [L,QSA]
RewriteRule club/details/(.*)-(.*).html$ club/details.php?id=$2 [L,QSA]


You could try a couple of things. One would be to reorder the rules:

RewriteRule club/details/(.*)-(.*).html$ /club/details.php?id=$2&%{QUERY_STRING}
RewriteRule club/(.*)-(.*).html$ club.php?id=$2&%{QUERY_STRING}

Another would be to change the pattern so that forward slashes don't match the club name, like so:

RewriteRule club/([^/]*)-(.*).html$ club.php?id=$2&%{QUERY_STRING}
RewriteRule club/details/(.*)-(.*).html$ /club/details.php?id=$2&%{QUERY_STRING}
0

精彩评论

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

关注公众号