我正在尝试创建一个重定向正则表达式脚本,它将用户转发到另一个具有完整路径的域,除非路径与特定内容匹配。
IE
http://www.a.com/anything/foo/bar -> http:www.b.com/anything/foo/bar
但是如果路径以特殊的开头,则不要重定向:
http://www.a.com/special/1/2/3 -> no redirect
我的重定向应用程序是这样工作的:我逐行输入条目(这工作正常):
"^/(?P<path>[-\w]+)/(?P<foo>[-\w]+)/(?P<bar>[-\w]+)/$","%(path)s/%(bar)s/%(foo)s/"
"^/(?P<path>.*)$","http://www.b.com/%(path)s"
所以像这样的东西(不起作用):
"^/(?P<path>!(special).*)$","http://www.b.com/%(path)s"