Web Hosting Talk







View Full Version : Best way to redirect domain names to subsites


deshg
01-25-2010, 09:11 AM
Hey everyone,

I'm not 100% sure i'm posting this in the right place, but i wasn't sure which forum was best, so feel free to move this if relevant.

I have setup a site that allows users to login and create their own websites (by choosing from various layouts then uploading pics and text etc). This is all run off one flash file which is hosted on my main domain and each users site can be viewed via www.mydomain.com/username. I am tryin to integrate the ability to purchase their own domain name (which will obviously then link through to their site) so as to give themselves a full online presence. This is the reason for my post, i'm trying to work out the best way of doing this. It has to be some kind of redirect as i do not want to duplicate the template and host it alongside their domain. As they are flash sites they are only one page (so this makes it easier), however the problem is i want the new domain they have purchased (theirname.com) to mask my domain, come up in Google etc and be the relevant domain (and not mydomain.com/username).

I'm really not sure the best way of doing this, I kind of want the opposite of a 301 although i'm not sure what that would be! I assume there is someway of doing this via an htaccess file, however this would require hosting for each domain which i would really rather avoid (as this is the only reason i would need it). Presumably however there's some way of redirecting theirname.com to mydomain.com/username then having an htaccess file on my end which rewrites the URL etc no matter what the entry route. From what i can see most of the domain masking options offered by domain registrars are not good from an SEO perspective and cause problems like duplicate content.

I would really appreciate anyones thoughts on this as i am rather confused and i'm sure there is a best practise way of doing this :)

Thanks very much everyone,

Dave

HTTP404
01-25-2010, 09:12 AM
If you using something like cPanel simpl redirect the domain.
Are you looking for an automated solution?

xtrac568
01-25-2010, 09:20 AM
if you are using e.g. apache for your webserver and you don't mind creating virtualhost for every domain of your users, then you can create an virtualhost with ServerName theirdomain.com and point that virtualhost to specific directory in your webserver directory root.

After that your users point their domains to your webserver ip using A record OR they point their domains to your nameservers and you create required A records for them.

If you are using cPanel, addon domains feature should accomplish the same.

Dr:linux
01-30-2010, 07:19 AM
Cpanel offers the best and the easiest way of redirecting domains...Majority are using that and any issues can be fixed withe ease.

deshg
02-01-2010, 10:21 AM
Thanks very much for your replies everyone.

Drlinux/crj: when you say CPanel is the easiestm which way do i do it within there if i were to do it manually (although longer terms i'd prefer to automate it). All i can find is the redirects options within the Domains section, but this only allows a 301/302 redirect which (i think!) will mean the destination url (mine) will be displayed and accessible by search engines? Is there another way of doing it that you were referring to, i think there is, but i can't find it!

Xtrac568: I am waiting to hear back from my hosts (i have reseller hosting) as to whether i can change my httpd.conf file (and hence add virtual hosts). Presumably this would probably be the best way to do what i want as then the original domain will always be the one displayed in the address bar no matter what happens? The only problem i can forsee is i need to pass a relevant variable that defines the originating domain (eg domain1.com would go to mydomain.com/userpage/index.php?username=domain1 and domain2.com would go to mydomain.com/userpage/index.php?username=domain2).
Using virtualhosts to direct to the relevant subdirectory/page seems fine, but i'm not sure how i would go about passing in the relevant variable? Would the only way be to setup a separate directory for each domain and then specify within the initial index file it redirected to what the variable was? Presumably addon domains has the same issue because you have to redirect to different directories for each domain?

Thank you so much for your help in advance and my apologies if my reply is not that clear, i am still trying to get my head around it!

Thanks very much guys,

Dave