cppit
cppit

Reputation: 4564

how do I pass 2 parameters using RewriteEngine in htaccess

Hello here is what I have :

RewriteRule ^page_([^/]*)$ /page.php?id=$1 [L]

this works great when the link is domain.com/page_3 it displays page page.php/id=3 . Now I want to pass it this way: domain.com/page_3&u=username. but it keeps saying page not found. I changed that line to this : RewriteRule ^page_([^/]*)$ /page.php?id=$1&u=$2 [L] (doesn't work) what am I missing ?

Upvotes: 0

Views: 79

Answers (1)

Madra David
Madra David

Reputation: 151

You can try this for 2 parameters

RewriteRule ^page_([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$  /page.php?url=$1&url2=$2 [L,QSA]

And this for three ,and so on and so on

RewriteRule ^page_([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$   /page.php?url=$1&url2=$2&url3=$3 [L,QSA]

Upvotes: 1

Related Questions