Forum Moderators: phranque

Message Too Old, No Replies

How To Mod ReWrite Away : AND ; (colon AND semicolon)

It always converts to %3A and %3B which only shows A and B because...

         

rollinj

10:08 am on Nov 11, 2007 (gmt 0)

10+ Year Member



I have a few constant variables visible in my urls at the moment which include colons and semicolons..

I'm using the htaccess code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.+)$ /?var1=0595412[b]%3A[/b]&q=$1 [L,QSA]

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

Ideally domain.com/query would be the same as domain.com/?var1=0595412%3A&q=query however..

Apache always converts ":" to %3A and ";" %3B which only shows A and B because %3 is assumed as a variable (which is blank because I have not set it).....?

How do I escape colons, semi colons, and percent signs in htaccess regular expressions?!
THANKS!

jdMorgan

2:58 pm on Nov 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See the [NE] flag documentation for RewriteRule.

Jim

rollinj

9:02 pm on Nov 11, 2007 (gmt 0)

10+ Year Member



Thanks Jim! Definitely a shove in the right direction..

However - not apache seems to be automatically converting any escaped percent signs to %25 which IS a percent sign yes but not the exact character I'm searching for..

There seems to be a lack of documentation online referncing NE

I found a small blurb on [httpd.apache.org...] that doesn't even work as described.. any more ideas?

jdMorgan

9:27 pm on Nov 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To be clear, none of these work?

RewriteRule (.+) /?var1=0595412\%3A&q=$1 [NE,L,QSA]
RewriteRule (.+) /?var1=0595412:&q=$1 [NE,L,QSA]
RewriteRule (.+) /?var1=0595412\:&q=$1 [NE,L,QSA]

Jim

rollinj

2:54 am on Nov 12, 2007 (gmt 0)

10+ Year Member



My apologies - you were correct the first time! I was just over tired/firefox's cache was tricking me! Thanks for all your help!