【发布时间】:2009-11-27 02:55:22
【问题描述】:
我在构建网站时曾经在我的 .htaccess 中有以下规则:
RewriteRule ^test/(.*) cgi-bin/router.py?request=$1 [NC]
每当用户转到mysite.com/test/something 时,他们都会被重定向到cgi-bin/router.py?request=something。这工作得很好。
我现在已经完成了该网站并想“打开它”。然而,简单地从规则中删除test/ 位是行不通的,尽管它应该根据here 和here:
RewriteRule ^(.*) cgi-bin/router.py?request=$1 [NC]
我也尝试过^$,但随后我丢失了用户在 url 中键入的内容。
我的正则表达式弄错了吗?
【问题讨论】:
标签: regex apache mod-rewrite