Forum Moderators: phranque

Message Too Old, No Replies

subdomain to subdirectory when subdomain sits on different DNS

can this be done?

         

higgins

3:58 pm on Feb 18, 2010 (gmt 0)

10+ Year Member



We have a yahoo store (I know, our first problem) that allows us to create subdomains and point them to a different name server. So we have:

www.example.com - main yahoo store, little flexibility, but has good SEO on some pages
store.example.com - "substore" on a miva cart that we are using for paid search traffic to test. this subdomain points to a different server/dns (miva hosted)

The substore is doing very well from a conversion standpoint and we will eventually want to move the entire store to the miva cart.

The concern we have is SEO becuase once we move the store over, we will have all of the products under this subdomain.

What we would like to know is if there is a way to rewrite the subdomain URLs to subdirectories while the subdomain still points to the other DNS...
so, we would want the store.example.com to be example.com/store, even though it sits on a different name server.

Make sense? Possible?

jdMorgan

5:44 pm on Feb 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure I fully understand your question. DNS is used by browsers to "convert" a domain name to an IP addresses before sending an HTTP request to a server at that IP address -- All HTTP requests issued by browsers are sent to IP addresses, and domains exist primarily as a mnemonic for the IP address. With the advent of name-based virtual servers and HTTP/1.1, the domain name (hostname) is sent in a header along with the request, and used by the server to select the appropriate name-based virtual server, but the whole client request and header "package" is sent to an IP address, not to a domain.

Therefore, the statement "while the subdomain still points to the other DNS" doesn't make sense.

If you are asking how to forward requests for "subdomain.example.com" on one server to example.com/subdomain-directory on another server without showing the latter URL in the browser's address bar, then yes it can be done. But it requires setting up a reverse-proxy so that example.com/subdomain-subdirectory appears in the URL-space of subdomain.example.com -- and this requires access to the server's configuration files, something you're not likely to have on cheap/free hosting.

However, this "reverse-proxy forwarding" isn't strictly necessary if your plan is to move the site to the Miva server "all at once." Assuming (and I don't know) that you can arrange for an IP-based virtual host --often referred to as a server having "a unique/non-shared/dedicated IP address"-- then you can simply copy the site over, change the DNS for example.com to point to that Miva server instead of the Yahoo server, and then use mod_rewrite on the Miva server to 'steer' requests to the proper subdirectory based on the requested hostname.

Even if you cannot get a dedicated IP address on Miva, you may still be able to accomplish this: Common control-panel set-ups allow for the creation of a limited number of "add-on domains," each hosted in a subdirectory of the "main domain." These act as separate sites, and no sign of the subdirectory-hosting is visible to Web clients. While this limited set-up often precludes sharing scripts and files between the main and the add-on domains, it may be sufficient to your needs.

I should mention that the term "add-on domain" is generic; In general, it makes no difference if the "add-on" is an entirely-different domain, or an additional subdomain of the "main domain." So this should not be a concern.

If you're paying for Miva service, I'd suggest calling them and asking if they can help you with either of these approaches.

Jim

higgins

10:44 pm on Feb 18, 2010 (gmt 0)

10+ Year Member



Ok... sorry for the confusion. What we would like to know is if there is a way to rewrite the subdomain URLs to subdirectories while the subdomain still points to another hosting server.



Quick breakdown:

One domain, two hosting platforms

Currently have an A Record pointing a subdmain to a new hosting server (Miva Merchant host) with the www domain on a Yahoo cart server. Instead of having them go to a subdomain, is it possible to have traffic sent to a subdirectory, with that subdirectory being hosted on a different server:

www.mydomain.com would be hosted as a Yahoo store

www.mydomain.com/miva would be hosted as a Miva store

Right now it is miva.mydomain.com but we would want it as www.mydomain.com/miva but hosted on a different server from www.mydomain.com

jdMorgan

1:07 am on Feb 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> ... a way to rewrite the subdomain URLs to subdirectories while the subdomain still points to another hosting server.

You can put code on that "other hosting server" and rewrite to subdirectories in that server, but otherwise, no.

Jim