rusly
rusly

Reputation: 1522

htaccess RewriteRule query string

Below is my accessories page url

http://localhost/motobatt/index.php?route=information/static&p=62&b=59

and this page already can access using this url

http://localhost/motobatt/accessories

but now how to pass those query , url should be like this

http://localhost/motobatt/accessories&p=62&b=59

My .htaccess

RewriteBase /motobatt
RewriteRule ^accessories index.php?route=information/static&p=$1&b=$2

Upvotes: 0

Views: 1245

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

Remove the &p=$1&b=$2 bit from your rule. There isn't any capture groups for the $1 or $2 to back reference so they'll just end up being blank. What you want is to use the QSA flag which will append any existing query string to the end of your rule's target:

RewriteBase /motobatt
RewriteRule ^accessories index.php?route=information/static [QSA]

Upvotes: 1

Related Questions