我想在 url 的根文件夹中捕获所有 URLwww.example.com
url 不能以斜杠结尾,也不能包含任何斜杠。
所以这些应该通过:
www.example.com/abc
www.example.com/abc123-asdf
www.example.com/abc123/ ** FAIL!
此外,子文件夹,如:
www.example.com/asdfsd/asdf ** FAIL!
我想在 url 的根文件夹中捕获所有 URLwww.example.com
url 不能以斜杠结尾,也不能包含任何斜杠。
所以这些应该通过:
www.example.com/abc
www.example.com/abc123-asdf
www.example.com/abc123/ ** FAIL!
此外,子文件夹,如:
www.example.com/asdfsd/asdf ** FAIL!
What web server are you using? If you're using Apache, what you want is URL Rewriting (mod_rewrite)
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
It has full regular expression support. and can automatically change all offending requests to the default url for you.