Apache Rewrite and Alias ​​combined

We ran into a problem where we have an existing alias and we would like to add a rewrite rule to catch all variants of case insensitive words i.e.

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

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

      

We need a rewrite rule:

/ExamPle

/exampLE

/eXAmple

      

etc.

We cannot force rewrite and alias to work together.

+2


a source to share


1 answer


In your main configuration:

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

      



The magic is in the NC modifier (no case). If you don't want to forward, you can omit the R modifier. The PT (through) modifier should work well with Alias

.

+2


a source







All Articles