RewriteRule使用RewriteCond不起作用

时间:2013-08-06 22:16:57

标签: .htaccess mod-rewrite

我想要得到这个

http://my.url.com/login/

重定向到:

http://my.url.com/app/index.cfm?event=user.login

我正在使用此重写规则但它无效。

RewriteCond %{REQUEST_URI} ^/login/$
RewriteRule ^/app/index.cfm?event=user.login [NC,L]

我做错了什么?

由于

1 个答案:

答案 0 :(得分:0)

RewriteRule的第一个参数是与URI匹配的模式,并且您缺少该模式。尝试:

RewriteRule ^/?login/$ /app/index.cfm?event=user.login [NC,L]

如果要从外部重定向浏览器,请在方括号中包含RR=301(永久)标记,例如[NC,L,R=301]