DNS Woes. Redirects. Subdomains. A Name Records. Help!
October 6, 2014 10:33 AM   Subscribe

I'm building a website for an awareness campaign for the New York chapter of a national non-profit. The new site will be hosted on my server. We're going to need a DNS redirect.

Let's call the national organization "national.org."

The New York chapter's website currently can be accessed by the URL "newyork.national.org" and "national.org/newyork." The latter URL is particularly important because that's what the New York chapter uses to direct people to its website.

I'm building a Wordpress website on my server that will replace a website that is currently accessed at "http://newyork.national.org/engage/." (Trying to access it by "http://newyork.farmland.org/engage/" doesn't work - this just gives you the New York site. I'd like to fix that if I could.)

Once we want to take the site live, how do we set up the redirect to the site on my server?

As an added bonus, the consultants who built the national and New York websites are long gone and I haven't obtained login information to the domain name registrar or website control panels. It looks like they're using Verio's nameservers and that the national site is hosted on Rackspace, but I'm not positive.

I'm trying to wrap my brain around how this is going to work once I do get that info - How do I set up a test to practice how to do this?
posted by chocolatepeanutbuttercup to Computers & Internet (5 answers total)
mod_rewrite and rewrite the URL to engage-ny.national.org which is your server and just needs standard DNS A record setup? And if you want national.org/newyork/engage to work too, mod_rewrite will do that too.

You maybe could clean up this question a bit and get better answers. Diagram the physical servers and give URLs that need to hit them. I'm not sure why hosting is split between your server and their normal server because I don't know who you are. If you're a random consultant just like those other long gone consultants, you will be long gone eventually too so do they really want you hosting things... If you're an employee working on their web presence maybe the story is different. farmland.org snuck in there when I expected you to ask about national.org/newyork/engage. I don't know. Just slightly confused 8)
posted by cmm at 10:47 AM on October 6, 2014

There are two places to change what a URL points to. The "host" portion is between the "http://" and the first "/" after that, and is maintained by the DNS server that the domain registrar points the domain to. And it's a bit of a struggle that you've given us hypothetical names, because we can't pin down registrars and DNS providers and server providers for you.

So when my computer aks for newyork.national.org, it (with some abstraction in here) first goes to the registrar to get the DNS servers for national.org, and then asks the DNS servers for an IP address for newyork.national.org.

In order to change the server that responds to requests to newyork.national.org or newyork.farmland.org, you either have to have login information for the domain registrars for national.org or farmland.org, respectively, so that you can change which DNS provider is serving responses to request for that information, or you need to have login information for the DNS provider to get them to change that information.

I think that what you're saying is that you're developing on the server at newyork.farmland.org, and when your client signs off on that, you want to make that server live. So you need to tell the server DNS for the domain national.org that newyork.national.org now points to the IP address for newyork.farmland.org, OR you need to move all of national.org's DNS over to new DNS servers, and then tell that new DNS server to make that change.

Does that clarify anything?

The portion after that first single "/" is managed by the server that either newyork.national.org or newyork.farmland.org, and answers to that depend on which web server software is being run on those servers.
posted by straw at 10:52 AM on October 6, 2014

(might want to edit the question)

The basic principle here is that you can't use DNS to map subdirectories to servers. You could theoretically set up some kind of ProxyPass on the New York server so that /engage/ proxies your Wordpress site at newyorkengage.yourserver.com, but that would require the kind of low-level admin control over Apache configs that isn't always available. It's also not massively efficient.

You could also change the DNS for newyork.national.org so that it points to a thin front-end reverse proxy that then maps subdirectories to servers. Again, that's a bit of a kludge for welding together two different web properties.

It'd be easier if you could migrate your WP site onto the server that's currently hosting newyork.national.org, even though that's probably going to create more long-term technical debt for the organisation.
posted by holgate at 10:53 AM on October 6, 2014

Don't proxy your web servers. I'm not Linux guy, but from my research, you can do this with mod_rewrite or .htaccess. These will silently and immediately redirect one URL to another. You want a 301 Permanent Redirect. I defer to @cmm on the details.

Edit - If you want the URL to remain the same but the site to be on another physical server, then you may need to Proxy or something else fancy. I may be misunderstanding the question, but if you just want to send someone to your Wordpress blog, rewrite the URL as described above. If it's something else, maybe clarify the question.
posted by cnc at 3:48 PM on October 6, 2014

Yeah that's what I was getting at too. You really need to restate your requirements. In the below I'm assuming that farmland.org and national.org are the same and you just typoed your actual domain instead of your generic example domain. But if not, just add it to the list...

If it is:
national.org/newyork -> content
newyork.national.org -> same content
newyork.national.org/engage -> content but on a different server
national.org/newyork/engage -> same content on the different server

Assuming you're using Apache, the first two are just normal Apache directives, though honestly, it would be cleaner to use mod_rewrite to 301 redirect to the one you want to be the "real" one. That doesn't get rid of the option to use both, but it makes the URL in browsers (and any future bookmarks) into the preferred URL.

For the other two, you have three choices.

The obvious cleanest is to run your new content on the same webserver and just use standard Apache directives, making it no different than the other two.

The next cleanest would be to use mod_rewrite and a new host (lets say engage.newyork.national.org) whose DNS points to your host (standard DNS setup, A record, PTR if you do them). Then use mod_rewrite to change the two example URLs into 301 redirect for engage.newyork.nation.org. This will cause the browsers to display this new URL and go directly to the new site (yours) which means usage statistics will be split up.

The ugliest in my opinion would be to use mod_proxy to proxy traffic from their webserver to yours. This causes the traffic to go from client browser->main server and then main server->your server so browser stats can be collected from the main server. The client browser would think everything is coming from the main server. A degenerate case similar to this would be to have a third server that is purely a proxy server that chooses their server or your server.

DNS is the least of your worries for any of this...
posted by cmm at 2:07 PM on October 7, 2014

« Older Has anyone else heard of lower-case "g" gumbies?   |   Buying a late-model used car Newer »
This thread is closed to new comments.