2

We have run into an issue where we have an existing Alias, and we would like to add a rewrite rule to catch all variations of case-insensitive spellings, ie:

URL:  http://www.example.com/example

Alias  /example  "/var/www/html/web/example"

We need a rewrite rule to catch:

/ExamPle

/exampLE

/eXAmple

etc ...

We cannot seem to get the rewrite & Alias to work together.

halfer
  • 19,824
  • 17
  • 99
  • 186
Larry
  • 21
  • 1
  • 2

1 Answers1

2

In your main configuration:

RewriteRule ^/example(?:$|/)(.*) /example/$1 [NC,PT,R]

The magic is in the NC (no case) modifier. If you don't want a forward, you can omit the R modifier. The PT (pass-through) modifier should make it play well with Alias.

Artefacto
  • 96,375
  • 17
  • 202
  • 225
  • Thank you very much for the reply. Unfortunately , this results in the following error: Bad Request: Invalid URI in request GET /example HTTP/1.1 I found how apache internally processes Aliases & Rewrites: Internal Processing: /xyz/oldstuff.html -> /abc/def/oldstuff.html (per-server Alias) /abc/def/oldstuff.html -> /abc/def/newstuff.html (per-dir RewriteRule) /abc/def/newstuff.html -> /xyz/newstuff.html (per-dir RewriteBase) /xyz/newstuff.html -> /abc/def/newstuff.html (per-server Alias) Any help would be appreciated Thanks! – Larry May 13 '10 at 16:18
  • Please write what are your current relevant configuration directives. – Artefacto May 13 '10 at 19:22