简体   繁体   中英

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.

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.

ie www.domain1.com should forward to subdomain.domain2.com and show www.domain1.com in the address bar. Meanwhile, my www.domain2.com should still render the other wordpress site I have there.

Am I right in thinking I need to do this through my htaccess file? 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.

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.

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. You will then need to set up your Wordpress install to respond to "www.domain1.com" requests.

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.

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 )

I dont think .htaccess is a good idea for achieving what you described.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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