简体   繁体   English

将域指向单独的子域和域

[英]Pointing domain at seperate sub-domain & domain

I have a domain residing with one organisation for managing DNS and a wordpress site built as a sub-domain of another site of mine. 我有一个域,一个组织用于管理DNS,一个wordpress网站作为我的另一个站点的子域构建。

I set up web forwarding, expecting the domain to be reflected in the address bar for site visitors, but the sub-domain is showing instead. 我设置了Web转发,希望该域反映在站点访问者的地址栏中,但该子域却在显示。

ie www.domain1.com should forward to subdomain.domain2.com and show www.domain1.com in the address bar. 即www.domain1.com应该转发到subdomain.domain2.com并在地址栏中显示www.domain1.com。 Meanwhile, my www.domain2.com should still render the other wordpress site I have there. 同时,我的www.domain2.com仍应呈现我在那里的另一个wordpress网站。

Am I right in thinking I need to do this through my htaccess file? 我是否认为我需要通过htaccess文件执行此操作? If so, can anyone advise on the syntax I need to use to do this? 如果是这样,谁能建议我需要使用的语法? I can currently only find information on mapping a sub-domain to the www of the same domain. 我目前只能找到有关将子域映射到同一域的www的信息。

Thanks in advance :-) 提前致谢 :-)

This comes down to the provider's definition of "web forwarding", which is a vague marketing term. 这归结于提供商对“网络转发”的定义,这是一个模糊的营销术语。 It sounds like they're just doing a straight redirection unfortunately, which no amount of playing with .htaccess files can fix: you simply cannot make a website tell the browser to stick another domain name in its address bar. 不幸的是,听起来他们只是在进行直接重定向,无法解决.htaccess文件的问题:您根本无法使网站告诉浏览器在其地址栏中粘贴另一个域名。

What I'd suggest is talking to them and see if they can do a CNAME for www.domain1.com to subdomain.domain2.com , or switch to it using the same IP address instead. 我建议与他们进行交谈,看看他们是否可以将www.domain1.comCNAMEsubdomain.domain2.com ,或者改用相同的IP地址切换到该名称。 You will then need to set up your Wordpress install to respond to "www.domain1.com" requests. 然后,您需要设置Wordpress安装以响应“ www.domain1.com”请求。

do you have control panel for your domains? 您的域是否有控制面板?

Im using direct admin and they call it "domain pointers" - I believe it does exactly what you need. 我使用直接管理员,他们称其为“域指针”-我相信它完全可以满足您的需求。

You need to create alias for your subdomain.domain2.com which will point (not forward, if you forward it also url in browsers address bar will be changed) www.domain1.com to the subdomain.domain2.com without url change. 您需要为您的subdomain.domain2.com创建别名 ,该别名将指向(不转发,如果转发,则浏览器地址栏中的网址也会更改)www.domain1.com到subdomain.domain2.com,而无需更改网址。

If you are not using any control panel, you need to create alias manually by adding same dns for your www.domain1.com (no matter A or CNAME) as it is for subdomain.domain2.com AND in server configuration set response for www.domain1.com (ie. apache servername and serveralias , in iis binding ) 如果未使用任何控制面板,则需要通过为www.domain1.com(无论是A还是CNAME)添加与subdomain.domain2.com相同的dns手动创建别名 ,并在www的服务器配置中添加响应.domain1.com(即iis 绑定中的 apache 服务器名serveralias

I dont think .htaccess is a good idea for achieving what you described. 我认为.htaccess对于实现您所描述的内容不是一个好主意。

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

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