nedge2k
nedge2k

Reputation: 109

.htaccess - drop/edit/remove query string parameter/flag

I'm trying to turn this:

/index.php?param1=1&param2=1&param3=1

into this:

/index.php?param1=1&param3=1

I would have thought this would work:

RewriteCond %{QUERY_STRING} param2 [NC]
RewriteRule ^index.php?(.*)param2=([0-9]+)(.*)$ index\.php\?$1&$3 [R=301,QSA,L]

...but it and other variations are doing sod all :(

any ideas?

Upvotes: 2

Views: 570

Answers (1)

Oussama Jilal
Oussama Jilal

Reputation: 7739

Try this :

RewriteCond %{QUERY_STRING} ^(.*&)?param2=([^&]+)&?(.*)?$
RewriteRule ^index\.php$ index.php?%1%3 [L,R=301]

Upvotes: 3

Related Questions