Forum Moderators: phranque

Message Too Old, No Replies

GET doubly html encoded on rewrite engine redirect, bug?

if test=monkey/one then ?test=monkey%2Fone becomes ?test=monkey%252Fone

         

phazei

12:02 am on Jul 17, 2006 (gmt 0)

10+ Year Member



So I recently started using this code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ [domain.com...] [R=301,L]

which strips my 'www'.

I had some links that used _GET vars writen into the link.
Though the link was www.domain.com rather than domain.com.

I found that all the _GET variables showed up in the address bar like they were html encoded twice.

Since it had already been encoded when sent the first time all that was really encoded was all the "%" from the first encode. So everywhere there was a special character it became %25XX where XX is the hex for the character it's supposed to be.

I'm guessing that it isn't just because I'm stripping the 'www's. If I used that to redirect any pages or make some php var look like an subfolder, it would probably do the same.

Is this a bug or just me?

Thanks
Adam

jdMorgan

6:12 pm on Jul 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you mean that you have "%" symbols inside the URL (not the query string), then the server will encode any that it finds, since that is an HTTP requirement. If you wish to override that, see the [NE] rewriterule flag.

Jim