Home  |  About  | Last |  Submit  |  Contact
AllQuests.com




Previous Question:  how to add autogenerated word of day to site  Just Starting Your DesignNext Question:  Script to copy multiple fields to one.  Just Starting Your Design
Question Need some advice on multiple domians ( SitePoint Forums Just Starting Your Design )
Updated: 2008-08-12 07:19:10 (9)
Need some advice on multiple domians

Hey guys!

I am looking for some opinions on how to handle the following. I am building a business portal for local businesses. Obviously this has been done many times, but in my area they seem to target the region (quad county area)and users have to sift through this portal to get to thier local area business information.

I'm targeting 4 cities. each its own url, for example - "mycityonline.com". But I dont want to have to pay hosting for all 4, and still want the user to able to type the specific url (mycityonline.com) to get to the appropriate portal.

I am new to the php/database concept.. Is there a way that I would be able to forward the domains to one url and then detect the url the user is looking for to direct them to the appropriate city portal. Hope that makes sense.

If I am off in another world here, please say so. I am just trying to figure out the best way for the user to type in the unique city url to get specific city info with out hosting 4 seperate sites. I am open to any and all ideas! If its a stupid or obvious question, I appologize up front.

Thanks in advance for your opinions. This forum rocks!

Answers: Need some advice on multiple domians ( SitePoint Forums Just Starting Your Design )
Need some advice on multiple domians

yup, pretty easy.

u buy each domain, then have them point to a script on your main domain, say findoutwhatcity.php, then in findoutwhatcity.php, you have the following code:

PHP Code:

<?php // findoutwhatcity.php

if ($_SERVER['HTTP_REFERER'] == "http://city1.com") {
  
header("Location: /city1-index.php");
}
if (
$_SERVER['HTTP_REFERER'] == "http://city2.com") {
  
header("Location: /city1-index.php");
}
if (
$_SERVER['HTTP_REFERER'] == "http://city3.com") {
  
header("Location: /city1-index.php");
}
if (
$_SERVER['HTTP_REFERER'] == "http://city4.com") {
  
header("Location: /city1-index.php");
}
else {
  
header("Location: /errors.php?error=hey there's no city there!");
}
get the idea?

Add

Need some advice on multiple domians

Excellent! Sounds simple enough. I appreciate you taking time to respond and write the example. Again, Many Many thanks....

puckhead

Need some advice on multiple domians

Instead of redirecting, which could cause search engine problems. I suggest just doing an include depending on what domain is used. This way you don't need to redirect... and to the client there is no way to even tell that you're running 4 sites off one script.

aspen

Need some advice on multiple domians

Aspen,

good point! If you know of any resources you could point me to about includes, I would appreciate it. I haven't much experience with includes yet. Thanks for the reply.

puckhead

Need some advice on multiple domians

Or you could just have multi-domain hosting...

Jeremy W.

Need some advice on multiple domians

Quote:
Originally posted by Jeremy W.
Or you could just have multi-domain hosting...
I second this suggestion. Much better, and less of a hassle.
I was using Aletia for hosting way back, and they still offer multi-domain hosting. The first 3 is free (I don't know if that includes the main domain or not) and each one after that costs $25. Aletia was GREAT when I used them. Offered support via ICQ and all!

M. Johansson

Need some advice on multiple domians

I am going to check out that option also. I wonder how the folks at sitepoint do theirs. They have a bunch of domains for the different sections. hmmmm!

thanks for the input - going to do some more research.

puckhead

Need some advice on multiple domians

FYI I used Aletia for about a year. The first 4 months it was good, then it went downhill. At the end they were a disgrace.

To use includes you'd use that same code above (I might use a switch instead of a bunch of if's) but you change...

header("Location: /city1-index.php");

to

include("city1.php");

The benefit of this, like I said, is that it is handled completely server side, so no one knows the difference. And if you one day do get actual accounts for each site then you wouldn't have to change any urls.

With a redirection its bad because 1, search engines may not follow it and 2, half the people will link to each side of the redirect, so in effect your link popularity is halved.

aspen

Need some advice on multiple domians

Most people doing stuff like this are getting into bulk reseller accounts now, instead of the multi-domain hosting. I actually ended up with so many domains that I just bought into a hosting company, lol. You can find bulk reseller accounts that don't cost much more than a single hosting account will cost.

Peter

petertdavis

Previous Question:  how to add autogenerated word of day to site  SitePoint Forums  Just Starting Your DesignNext Question:  Script to copy multiple fields to one.  SitePoint Forums  Just Starting Your Design

- Source: Need some advice on multiple domians SitePoint Forums Just Starting Your Design
- Previous Question: how to add autogenerated word of day to site SitePoint Forums Just Starting Your Design
- Next Question: Script to copy multiple fields to one. SitePoint Forums Just Starting Your Design