Forum Moderators: phranque

Message Too Old, No Replies

user1.something.com > redirect > something.com/user1

         

iamrick

11:44 pm on Aug 4, 2003 (gmt 0)

10+ Year Member



Hi,

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]

Birdman

1:56 am on Aug 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello iamrick,

Welcome to WebmasterWorld!

I think the quick answer to your question is:

Make sure you get a host that runs Apache server, with .htaccess file access. Then you will have control over redirects/rewrites and such.

Hope it helps!

netcommr

2:37 am on Aug 5, 2003 (gmt 0)

10+ Year Member



what I have done in the past in this instance is make the domain point to the sub folder.

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]

thewebboy

4:59 am on Aug 5, 2003 (gmt 0)

10+ Year Member



Real quick php code that i use..

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/");
}
?>