开发者

Apache Rewrite and Alias combined

开发者 https://www.devze.com 2022-12-30 06:09 出处:网络
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:

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.开发者_如何学Goexample.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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消