gnoll marauder
gnoll marauder

Reputation: 35

Rewrite url with % in it

I have an URL like this:

http://www.domain.com/folder/?p1=%val1%&p2=%val2%&p3=10&p4=0.1

When clicked, I would like to go:

http://www.domain.com/folder/?p1={val1}&p2={val2}&p3=10&p4=0.1

Is it possible to be achieved within the .htaccess file? I want to avoid % sign (can't use %25 in the URL, because of other reasons).

Thank you in advance!

Upvotes: 1

Views: 22

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

Try:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)%([^%]+)%(.*)$
RewriteRule ^(.*)$ /$1?%1{%2}%3 [L,R,NE]

Upvotes: 1

Related Questions