URL re-writing problem
I am using this below code to re-write URL :
RewriteEngine on
RewriteRule ^buynow/(.*)$ Model/Public/BuyNow/buynow.php?str=$1&f=$2 [L]
But as in these lines,Second parameter "f"
is not working here.I have searched on google开发者_运维知识库 but not getting result.Kindly give your suggestions
Thanks
You only have one group (delimited by (
... )
) in your regular expression. $1
refers to what was matched in this group, and $2
refers to what was matched in a second group, which doesn't exist. Because there is no second group, $2
will always evaluate to ""
.
What part of the URL is f
supposed to represent?
EDIT: Based on your comments, it would seem the rule should look something like this:
RewriteRule ^buynow[^/]*/(.*)/([^/]*)$ Model/Public/BuyNow/buynow.php?str=$1&f=$2 [L]
You are only capturing one string, so there is no $2
corresponding to a second capture group.
The Rule you wrote supports the passing of 1 parameter only, the ^buynow/(.*)$ is one parameter which is not broken into 2, therefore your expected parameter will never arrive. Please post an example of the original URL so I can help you to resolve the issue.
精彩评论