Search code examples
mod-rewriteisapi

URL rewrite redirect issue


I rewrite all URLs to lowercase, and it works fine.

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) $1 [CL,R=301]

But there are few places where IDs used and IDs transform to this:

Original URI pattern (spaces are added to highlight replacement):

7f4320a7-9b13-4439-837f-ba0dbbed29ad %2C b3a990ae-b693-4496-b7cc-59f0b1cfc14a

Localhost:

7f4320a7-9b13-4439-837f-ba0dbbed29ad , b3a990ae-b693-4496-b7cc-59f0b1cfc14a

Dev server:

7f4320a7-9b13-4439-837f-ba0dbbed29ad %252c b3a990ae-b693-4496-b7cc-59f0b1cfc14a

I don't quite understand why it differs, apparently 0x2C is HEX for comma, but I have no idea how and why it transforms.

I use !(pattern Repeats in every ID using URL) as a temporary solution, but I'm curious what's wrong with it and can I use a condition that ignores HEX values.


Solution

  • Comes out I needed an to add [NE] (noencode) to RewriteRule (.*) $1 [CL,NE,R=301].

    %25 is a '%', so characters were encoded twice.