Forum Moderators: phranque
Finally I've found a wev development communinity that's bursting at the seems with content. Just looking at the amount of posts made me thoughroughly impressed - well done!
I've searched these forums on the above topic and found these two items: mod_rewrite and wildcard subdomains.
I'm primarily the graphics guy, but I was wondering if you could quickly tell me what I need to activate on my host for redirecting subdomains to a subdirectory.
Eg - [property1.example.com...]
> redirect >
[example.com...]
A script also has to create the subdirectory. This is for a real estate type site - so the content will stay indefinately.
My question is: what should I tell my host that I need? I currently don't have one, so I can search around and make sure they will enable certain features on their server avaliable.
Hope I made sense :)
Cheers,
Rick.
[edited by: tedster at 4:27 am (utc) on Jan. 14, 2004]
[edit reason] example.com for domain name [/edit]
Such as:
(just example, your paths probably different)
www.example.com points to /home/mysite/public_html/ as a document_root then sub.example.com points to /home/mysite/public_html/sub/.
This way either path works without anything fancy. Though, you can add an .htaccess in the ./sub/ folder to redirect if you need to.
[edited by: tedster at 4:29 am (utc) on Jan. 14, 2004]
[edit reason] example.com for domains [/edit]
INDEX.php
<?
$subdomain = strtolower($HTTP_HOST);
$subdomain = str_replace("www.", "", $subdomain);
$subdomain =str_replace("domain name here","",$subdomain);
if ($subdomain){
header("Location: [$HTTP_HOST...] . $subdomain . "/");
}
else {
header("Location: [domain...] name/home/");
}
?>