2012-07-16 29 views
0

应该是非常简单的。 URL区分大小写,因此我想重定向输入小写'm'的任何人。简单的mod重写规则不适用

任何想法为什么它不工作?

RewriteRule ^www.junaphotography.com/100moments$ http://www.junaphotography.com/100Moments/ [L,QSA] 

回答

0

RewriteRule的正则表达式匹配(第一自变量)压靠在URI,其中不包括主机名相匹配。可以省略主机名:

RewriteRule ^/?100moments/?$ http://www.junaphotography.com/100Moments/ [L,QSA] 

如果您确实需要确保该请求是针对www.junaphotography.com主机,添加RewriteCond

RewriteCond %{HTTP_HOST} ^www.junaphotography.com$ [NC] 
RewriteRule ^/?100moments/?$ http://www.junaphotography.com/100Moments/ [L,QSA] 
+0

感谢乔恩。不幸的是,这并没有奏效。尽管如此: 'code'RedirectMatch/100moments http:// www.junaphotography.com/100Moments /'code' – nedryk 2012-07-18 18:18:26

+0

在规则之前的某处是否有'RewriteEngine On'指令? – 2012-07-18 18:31:11