Problem: Need to redirect 'www.domain.name/xy' to 'xy.other.domain.net'.
I need the redirection from the first URL to work for both 'xy' and
'XY'. I figure why not make it work for the combinations 'xY' and 'Xy'
as well. Here is the virtual host configuration section of my Apache
HTTP server. The version I am running is 2.2.2.
<VirtualHost 192.168.0.1:80>
ServerAdmin admin at domain.name
DocumentRoot /www/htdocs
ServerName www.domain.name
ErrorLog /var/log/apache2/error_log-domain.name
CustomLog /var/log/apache2/access_log-domain.name combined
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/xy/(.*) [NC]
RewriteRule ^/xy/(.*) http://xy.other.domain.net/$1 [R=301,L]
</VirtualHost>
The above code works fine when this URL is used 'www.domain.name/xy'. As
I understand things, the [NC] code at the end of the 'RewriteCond' line
should indicate that the condition is case insensitive, but it doesn't
appear to be that way. The URL 'www.domain.name/xY' will not be redirected.
Armed with my very limited knowledge of regular expressions and
mod_rewrite, I tried the following two configurations (one at a time)
and neither worked:
RewriteCond %{REQUEST_URI} ^/[xX][yY]/(.*) [NC]
RewriteRule ^/[xX][yY]/(.*) http://xy.other.domain.net/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/[xy|XY|Xy|xY]/(.*) [NC]
RewriteRule ^/[xy|XY|Xy|xY]/(.*) http://xy.other.domain.net/$1 [R=301,L]
Any suggestions on how I can solve this problem?
Thanks, Mike