类似的域重定向
希望某人能够帮助我了解以下内容的工作方式,以及为什么还可以的话,为什么需要完成?
我有两个领域。
- domain-one.co.uk-这是主要域,并拥有SSL CERT
- domain-One-uk.com-这是我们客户拥有的另一个域,它不安全,他们希望它重定向到第一个域。
这仅仅是在公共文件夹中的HTACCESS文件中添加301规则的情况,还是我需要对DNS设置进行任何操作?
我添加了以下内容,但似乎没有工作
RewriteCond %{HTTP_HOST} ^www\.domain\-one\-uk\.com$
RewriteRule ^$ https://www.domain-one.co.uk/? [L,R=301]
会感谢任何帮助,并教任何人都能提供的帮助。
谢谢
Hoping somebody will be able to help me to understand how the following would work as well as why it would need to be done if that's okay?
I've got two domains.
- domain-one.co.uk - this is the main domain and holds an SSL cert
- domain-one-uk.com - this is another domain our client owns, it's not secure and they want it to redirect to the first domain.
Is this simply going to be a case of adding a 301 rule in the htaccess file in the public folder or do I need to do anything with the DNS settings?
I added the following but it didn't seem to work
RewriteCond %{HTTP_HOST} ^www\.domain\-one\-uk\.com$
RewriteRule ^$ https://www.domain-one.co.uk/? [L,R=301]
Would appreciate any help and teaching anyone can provide.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有现有的URL可以重定向,这只是一个域重定向,我将在Insecure Server上的.htaccess中进行基本301重定向,这将重定向到达新域的任何内容:
如果Insecure Server :曾经具有在安全服务器上也可用的内容(除了协议和域外,具有相同的URL),然后您确实需要使用重写器,例如。 :
在您的情况下,丢失的“重新写入”无疑导致重定向不起作用。
仅当两个域使用此htaccess使用此htaccess时,才需要检查当前域名(即。使用同一目录由同一服务器处理)。
If there is no existing URLs to redirect and this is only a domain redirect, i'd go for a basic 301 redirect in the .htaccess on the insecure server, which will redirect anything that arrives there to the new domain :
If the insecure server used to have content that is also available on the secure server (with the same URLs, besides the protocol and domain), then you indeed need to use RewriteRules, eg. :
In your case, the missing "RewriteEngine On" certainly caused the redirect not to work.
The RewriteCond that checks the current domain name is only needed if this htaccess is used by both domains (ie. they are handled by the same server, using the same directory).