我需要创建从myOldSite.com到myNewSite.com 的301重定向
我在myOldSite.com 的htaccess中有这个代码
#Redirect 301 / https://myNewSite.com/myPage/
这可以很好地重定向myOldSite.com
,但不能激发myOldSite.com/services.html
:的正确重定向
myOldSite.com
被正确重定向到myNewSite.com/myPage
但是
myOldSite.com/services
被重定向到myNewSite.com/myPage/services.html
这是错误的
正如您所看到的,services
被附加到末尾。这不是我需要的。我需要:
将myOldSite.com/services
重定向到myNewSite.com/myPage
任何以myOldSite.com/ANYTHING_HERE
开头的url都应重定向到myNewSite.com/myPage
使用RedirectMatch
RedirectMatch 301 / https://myNewSite.com/myPage
这不会将旧的URL子路径附加到目标URL。