我想将多个网址重定向到同一网页。
我可以这样做:
Redirect /index.html http://example.com/newdirectory/
Redirect /index1.html http://example.com/newdirectory/
Redirect /index2.html http://example.com/newdirectory/
Redirect /index3.html http://example.com/newdirectory/
Redirect /index4.html http://example.com/newdirectory/
Redirect /index5.html http://example.com/newdirectory/
有没有更好的方法来做到这一点? (更干净)
答案 0 :(得分:2)
是的,使用RedirectMatch
您可以在模式中使用正则表达式:
RedirectMatch 302 ^/(index|index1|index2|index3|index4|index5)\.html$ http://example.com/newdirectory/
或者更简洁:
RedirectMatch 302 ^/index[1-5]?\.html$ http://example.com/newdirectory/