Reputation: 9
I have a SEO friendly url like this : /blog/post/15
But now i want to pass an extra parameter like this:
/blog/post/15/?show_comments=1
But when i'm trying to access value of parameter 'show_comments' its returning null value.
I'm using follwing rewrite rule in .htaccess
RewriteRule ^blog/post/([^/\.]+) blog/post.php?id=$1&show_comments=$2 [L]
Note:- I don't want to pass extra parameter in url like this /blog/post/15/1
Upvotes: 0
Views: 486
Reputation: 96240
The original query string got replaced with the one you created in your substitution URL.
You need to use the QSA
flag (Query String Append) here to merge your new parameters with the already existing ones:
RewriteRule ^blog/post/([^/\.]+) blog/post.php?id=$1&show_comments=$2 [L,QSA]
Upvotes: 3