Mr URL Redirection & Mrs Search Results
February 16, 2011 11:06 AM   Subscribe

Client requested a single page website. Same client has bought himself a shiny new domain name - www.client.com. Given likely very low volume of hits, I propose hosting that single page under my existing Apache-enabled webspace - www.existing.com/client. How do I set things up such that Google results show client's domain and not my own? Thanks!
posted by freston to Computers & Internet (12 answers total) 1 user marked this as a favorite
 
Why change the URL? Just set up www.client.com as a virtual host on your existing Apache setup.
posted by teraflop at 11:10 AM on February 16, 2011 [1 favorite]


Yeah, use virtual hosting.
posted by delmoi at 11:14 AM on February 16, 2011


Why not store the site page as you intend, but just always refer to it as http://client.com/ (no need for the www), and set up your hosting account appropriately? Apache doesn't care where the files are; no matter where the site's main directory is, it can make it look like client.com is its own independent web site.

This would mean you wouldn't have to use a redirect at all.

If you're hosting somewhere that using a separate domain name for a new directory entails a $100/year hosting charge, you might be interested in the ways things are structured at Pair.com or other hosting companies.
posted by amtho at 11:14 AM on February 16, 2011




The only challenge you'll have with VirtualHost Apache directives is if you want / need SSL. I assume that's pretty much worthless for a single serving site, so you should be fine.
posted by pwnguin at 11:35 AM on February 16, 2011


Your domain registrar may provide domain forwarding with URL masking, which will accomplish this without you doing anything to Apache. Our homeowners association is actually just a simple Google Sites web site. The domain registrar masks the URL so it looks like www.hoa.com when you visit the site.
posted by COD at 11:58 AM on February 16, 2011


Will read up on the whole virtual hosting thing - thanks.

Domain registrar offers URL frame forwarding, so I guess that should do the trick and, as you say, be easy to set up. So Google results show your masked URL only and there's no sign of the full Google sites address?
posted by freston at 12:50 PM on February 16, 2011


Holding a page hostage in a frame gives a really poor user interface -- for example bookmarks don't work. (I know you said that it is a single page, but even in a single page you can have named anchors that someone might want to bookmark.) It's also (in my humble opinion) a sign of someone that either doesn't know what they're doing or is pulling some kind of scam. This technique doesn't hide the true site (existing.com) from anyone with a clue, and so it is also a mark of amateurism as it does not conceal the client-host relationship and puts the client in a bad light for not having a real web site.
posted by Rhomboid at 1:40 PM on February 16, 2011 [2 favorites]


Coincidentally, I was just reading up on this yesterday. There are some useful guides which include Apache virtual hosting, here.
posted by Diag at 1:49 PM on February 16, 2011


Rhombold - I take your point that frame forwarding is a cheap technique. Like I say, I'll try to get my head around the virtual hosting config.

And thanks for the Apache guides, people ... though I would be grateful if someone could point me to a particular section which comes close to my particular example.
posted by freston at 3:11 PM on February 16, 2011


It's not much more than
NameVirtualHost *:80

...

<VirtualHost *:80>
  ServerName client.com
  ServerAlias www.client.com
  DocumentRoot /path/to/client
</VirutalHost>
Note that once you enable name-based virtual hosting with NameVirtualHost, the old config (i.e. ServerName, DocumentRoot values outside of a VirtualHost stanza) goes away, so you need to move the configuration for existing.com into a <VirtualHost *:80> stanza.

Also, some distros have various ways of configuring the .conf file, for example they might have a conf.d directory and a corresponding Include .../conf.d/* statement, so that you're meant to drop in new vhost configuration fragments in that directory without having to edit the main .conf file. This is meant to make package upgrades easier as it makes it less likely for there to be a merge conflict when updating the main .conf file. Also, it's nice to be able to have each vhost have its own .conf fragment in its own file. But you can also certainly just ignore that and have one monolithic .conf file.
posted by Rhomboid at 4:38 PM on February 16, 2011


If your existing Apache enabled web space is shared hosting using CPanel, then the feature you need to look for is 'Addon Domains', otherwise, if you have a dedicated server or VPS, carry on with Apache config as described above.
posted by robertc at 5:08 PM on February 16, 2011


« Older English Novel Study   |   Can a predatory live with its prey? Newer »
This thread is closed to new comments.