Reputation: 29
I have an existing rule in my .htaccess that says
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ member.php?do=$1&uid=$2&id=$3 [L]
When I access a URL like http://mysite/posts/3
, the second parameter is working perfectly.. The ugly url of it is this:
http://mysite/member.php?do=posts&uid=3
But when I tried adding a third parameter like this one:
http://mysite/posts/3/2
Ugly Url is
http://mysite/member.php?do=posts&uid=3&id=2
It is not working anymore... I got ERROR 404 Object not found.
What am I doing incorrectly?
Upvotes: 0
Views: 78
Reputation: 22412
The rewrite rule
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ member.php?do=$1&uid=$2&id=$3 [L]
is wrong. It only catches "posts/3" but never "posts/3/2".
You can try adding 2 rules for example
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ member.php?do=$1&uid=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/([0-9]+)$ member.php?do=$1&uid=$2&id=$3 [L]
Upvotes: 1