开发者

condition not referencing the second rule

RewriteEngine On

RewriteRule (.*)/(.*)\.html index.php?page=$1&title=$2

RewriteRule (.*)/(.*)\.html index.php?profile=$1&staffName=$2 

Hi,

Basically I am trying to use mod_rewrite to make it开发者_如何学编程 so that when the variable id is page, it references the first rule and if the profile is isset then use the second rule.

But when I try it, the pages are fine but the profile pages are breaking as the mod_rewrite is trying to use the first rule and breaks.

Any help would be great.

Thank you


Thing is that mod_rewrite parses the requested URL according to the first statement and tranforms it according to the rules stated in the second one. But your initial URL-patterns are the same, so it can't distinguish them.

Also, forego the backslash of the file-extension-point ... I think that causes trouble.

Also you can test your rules very comfortable with this tool.

'RewriteRule (.)/(.).html index.php?page=$1&title=$2' for example works just fine and will transform /a/b.html to index.php?page=a&title=b.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜