简体   繁体   English

.htaccess 301重定向-新域托管在旧域的目录中

[英].htaccess 301 Redirect - new domain is hosted in directory on old domain

I have a site at site.com. 我在site.com上有一个网站。 It's moving to newsite.biz. 它正在移动到newsite.biz。

I log in to the hosting account for site.com and the directory tree is: directory-cgi-bin directory-newsite directory-wp-admin directory-wp-content directory-wp-includes all of the other Wordpress individual files such as wp-config.php wp-login.php etc. that go along with site.com 我登录到site.com的托管帐户,目录树为:directory-cgi-bin目录-newsite目录-wp-admin目录-wp-content目录-wp-包括所有其他Wordpress单个文件,例如wp -config.php wp-login.php等,与site.com一起使用

All of my newsite.biz files are in the newsite directory which is in the root of site.com I'm attempting to redirect all traffic from site.com to newsite.biz 我所有的newsite.biz文件都位于newsite目录中,该目录位于site.com的根目录中,我正在尝试将所有流量从site.com重定向到newsite.biz

Here's what I've tried: Redirect 301 /how-it-works/ http://newsite.biz/how-it-works/ The error it says is too many redirects. 这是我尝试过的方法:重定向301 / how-it-works / http://newsite.biz/how-it-works/上面显示的错误是重定向太多。

Any help is appreciated. 任何帮助表示赞赏。 Thanks! 谢谢!

I'm attempting to redirect all traffic from site.com to newsite.biz

You should use mod_rewrite rule for better control: 您应该使用mod_rewrite规则进行更好的控制:

RewriteCond %{HTTP_HOST} site\.com$ [NC]
RewriteRule ^ http://newsite.biz%{REQUEST_URI} [L,NE,R=301]

Also make sure this rule is before other rewrite rules. 另外,请确保此规则在其他重写规则之前。

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

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