问题原文
原帖链接 · Sid · CC BY-SA 4.0
I am in the process of doing a website redesign. We have changed the domain name and hosting server for the new project. Following are the rules that I am using in my htaccess file to perform a 301 redirect from the old domain to the new one:
Redirect 301 / http://www.newdomain.com/
Redirect 301 /about-us http://www.newdomain.com/about-us
Redirect 301 /locate-us http://www.newdomain.com/contact-us
RedirectMatch 301 .* http://www.newdomain.com/
The first two redirects are working as expected however the 3rd one is being redirected to http://www.newdomain.com/locate-us instead of http://www.newdomain.com/contact-us.
已采纳解答
原帖链接 · MrWhite · CC BY-SA 4.0
It seems it was a caching issue in this instance.
Bear in mind that any 301 (permanent) redirects that may have been in place earlier or had simply been used in testing (perhaps in error), are cached persistently by browsers (and possibly intermediary caches).
For this reason it can be beneficial to test with 302 (temporary) redirects until it's confirmed they work OK. And/or test with the browser's developer tools (object inspector) open and caching disabled. eg. In Google Chrome's inspector, check the "Disable cache" checkbox on the "Network" tab.
The "Network" tab in the browser's developer tools helps to validate exactly what redirects are occurring, 3xx status codes and when. This will also tell you whether the redirect was from cache (if caching is enabled) or whether it originated from the server.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
