tags:

views:

37

answers:

2

I'm having a directory website with sub-pages for each city. Like for example Newyork will have an address www.directory.com/newyork, LA will have www.directory.com/la

so i want to point the the domain newyorkdirectory.com to www.directory.com/newyork and so for each sub sections... what are the options I have.. can I do this in my code? Is there any way to detect the domain from php and load the content accordingly?

If all i point all the domain's to the site can i detect the incoming domain and refer them to a page? I totally have no idea on this.

Clarification: when people goto the site through newyorkdirectory.com the page www.directory.com/newyork/malls should be accessed through newyorkdirectory.com/malls

+1  A: 

so i want to point the the domain newyorkdirectory.com to www.directory.com/newyork

You mean you want all existing "newyorkdirectory.com" links of your website to point to "www.directory.com/newyork"? Or you want to point to "www.directory.com/newyork" when people try to go to "newyorkdirectory.com"?

Second case is impossible if you do not possess domain "newyorkdirectory.com", else you can reroute using Apache .htaccess I think.

GôTô
+1  A: 

Are you in control of the web-server? You can simply make the newyork folder the root for the newyorkdirectory.com domain. If it's coming from somewhere else, you could always drop a quick re-direct script on that domain... i.e. index.php:

<?php
header('Location: http://www.directory.com/newyork');
exit();
?>
Fosco
there will be no folder. It will just be a link... the site will be in codeigniter or wordpress...
esafwan
@esafwan then the redirect script is probably the right approach.
Fosco
will this www.directory.com/newyork/malls be like this newyorkdirectory.com/malls ?
esafwan
@esafwan That could be done with another redirect script in the malls folder. Honestly though, if you want to support additional redirects, you'd probably want to look at using htaccess rewrite rules..
Fosco