简体   繁体   English

301重定向不起作用

[英]301 Redirect doesn't work

To start, I know this is liked the nth time this has been asked here, but I've looked and tried the answers to the other posts and they didn't work. 首先,我知道这是第n次被问到,这是很喜欢的,但是我查看并尝试了其他帖子的答案,但它们没有用。

Anyway, I'm trying to redirect all out pages from the old domain to the new one with the same address (olddomain.com/this-page will go to newdomain.com/this-page). 无论如何,我试图将所有页面从旧域重定向到具有相同地址的新页面(olddomain.com/this-page将转到newdomain.com/this-page)。 This seemed to be the best one to work: 这似乎是最好的方法:

RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] 

While that redirects olddomain.com to newdomain.com, the subdirectories, other pages, etc doesnt seem to work. 虽然这会将olddomain.com重定向到newdomain.com,但子目录,其他页面等似乎不起作用。 When I type in the URL, I see the status change at the bottom say "Waiting for newdomain.com", but it still loads the page from olddomain.com 当我键入URL时,我在底部看到状态更改,说“ Waiting for newdomain.com”,但是它仍然从olddomain.com加载页面。

So I really would appreciate it if someone would tell me how to completely redirect all the pages from olddomain.com onto newdomain.com. 因此,如果有人告诉我如何将所有页面从olddomain.com完全重定向到newdomain.com,我将不胜感激。

Thanks a lot in advance :) 在此先感谢:)

RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM