Reputation: 3080
I have a website that on one specific page it requires an extra variable.
At the moment, the htaccess I am using is:
RewriteEngine On
RewriteRule ^([^/]*)/$ /index.php?page=$1 [L]
Which works fine with one variable.
How would I get it to work with : http://tessite.com/index.php?page=test&id=1
So it looked like: http://tessite.com/test/1
Thanks for any help or replies.
Upvotes: 1
Views: 197
Reputation: 13257
RewriteEngine On
RewriteRule ^(.*)/(.*)/$ /index.php?page=$1&id=$2 [L]
RewriteRule ^(.*)/$ /index.php?page=$1 [L]
Just add $2
!
Also, [^/]
isn't required, you can simply use .
.
Upvotes: 1
Reputation:
It can be coded like this:
RewriteRule ^([^/]*)/([^/]*)/$ index.php?page=$1&id=$2 [L]
Upvotes: 6