Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

85 users online



*.domain.com tutorial

*.domain.com tutorial

Currently viewing this thread: 1 (0 members and 1 guests)


Page 2 out of 2
BigToach

BigToach

Neversidian
Status: Offline!

ask em why?

Its a simple BIND setting, tell em if they need help to use google ;)

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

DigitalDream

DigitalDream

ruby on weapon
Status: Offline!

sorry i want to know if this method will work in local server ? im using xampp package. i dont know where the setting of wildcard DNS. i want to try it out in my local server. can you help me BigToach ?
i tried to activating virtualHost in httpd.conf but it doesnt work when i put the subdomain..:S
thanks and sorry if i bother you

___________________

digitalDream // complete Webdesign solution //
- - - - - - [ end signature ] - - - - - -

BigToach

BigToach

Neversidian
Status: Offline!

the simple answer is no. I'm sure there is a way to do it, I just dont get why you would want to. It was intended to be in use with a domain name.

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

DigitalDream

DigitalDream

ruby on weapon
Status: Offline!

bcos i want to apply this to my upcoming site. while i dont have broadband connection, the only thing i can do is develope the site in my local server.
you know, you can have domain in your local server (like http://www.domain.com instead of localhost) so i was just wondering if it would pe possible to do this
but yeah thanks for the hook up

___________________

digitalDream // complete Webdesign solution //
- - - - - - [ end signature ] - - - - - -

Last edited by DigitalDream, November 14th, 2005 07:27 AM (Edited 1 times)

BigToach

BigToach

Neversidian
Status: Offline!

well just code everything else, just dont use that one small peice until you make it go live

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Rad

Rad

thinking of something witty to put here
Status: Offline!

I've got something even easier. All you need is wildcard DNS, and that any missing sub-domains under your domain redirect to the www sub-domain (default).

PHP:

<?php

function user_key($host) {
  
$parts explode('.'$host);
  return 
$parts[0];
}

echo 
user_key($_SERVER['HTTP_HOST']);

?>


When you go to that script under rad.example.com, the function will return "rad". And when you go to scott.example.com, it will return "scott". See how easy that is? I have it in action at my site:

http://whatever.d.yayforgecko.com/user_key
http://rad.d.yayforgecko.com/user_key
http://scott.d.yayforgecko.com/user_key

(d.yayforgecko.com is a real sub domain, which mirrors my development box's web root. This works fine with normal domains.)

By the way, yes, you can test this on your local box.

Movie: http://yayforgecko.com/subdomains.mov

You can't have it totally dynamic; just a set of specified keys. To set it up, open your hosts file. This page shows you where you can find it. Once it's open, add a line like this:

Code:

127.0.0.1 rad.local.dev

The "rad.local.dev" can really be anything you want. Just remember the first "subdomain" will be the user key. Feel free to add multiple lines if you want. Save the file, and see if it works by going to http://rad.local.dev/. If it does, continue on to the next step: setting up a catch-all in Apache.

Open up your httpd.conf file, and find the section that discusses the <VirtualHost> directive. Once you get there, put in something like this:

Code:

<VirtualHost *>
DocumentRoot "/www/pages"
</VirtualHost>

Change /www/pages to wherever you want the document root to be. Now just access the server under http://rad.local.dev/, and the user key function will always return rad. I'm not sure of a way to make it a wildcard on your local machine, so you're going to have to stick with a single username for now.

Last edited by Rad, November 15th, 2005 05:17 AM (Edited 6 times)

BigToach

BigToach

Neversidian
Status: Offline!

Yeah that way works really well for really simple stuff because it is handled actually in the script and not inside of apache.

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

mcdude

mcdude

Blah
Status: Offline!

Good stuff Rad, you make things look easy.

DigitalDream

DigitalDream

ruby on weapon
Status: Offline!

oh Rad thanks a million you save me ! >_< i'll try this now

___________________

digitalDream // complete Webdesign solution //
- - - - - - [ end signature ] - - - - - -

Page 2 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0087 seconds.