PDA

View Full Version : [omgRLY] Dynamic Subdomains



Florx
30-12-2007, 03:50 PM
Hey,

You might remember the thread I made a while back about making dynamic subdomains - (like minicity or whatever that site is) but today I finally managed it!

I'l write a tutorial on how to do it when I have time but here's the working model!

http://subdomain.omgrly.com

Replace subdomain with anything (except img) and it will show you what subdomain you used. Pretty lame at the moment but it has the allowance to do anything because I did mod_rewrite so it points to http://omgrly.com/test/index.php?go=subdomain so it can be used for just about anything really.

Have fun playing and thanks,
Jake.

loserWILL
30-12-2007, 03:57 PM
That's neat. Good job.

Florx
30-12-2007, 03:57 PM
Thanks :)

Edit: 1000 posts! Woop!

Blob
30-12-2007, 04:10 PM
how do you do it lol? ive been searching for one like this for ages just the htaccess bit would do. ty =D

Florx
30-12-2007, 04:25 PM
Here you go



RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC]
RewriteRule ^(.*)$ index.php?go=%1 [L]


In cPanel you need to add a subdomain: *.domain.com with it pointing to /public_html/ and then it will work

Blob
30-12-2007, 05:47 PM
Here you go



RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC]
RewriteRule ^(.*)$ index.php?go=%1 [L]


In cPanel you need to add a subdomain: *.domain.com with it pointing to /public_html/ and then it will work

Ive been searching for ages and then you posted, and then i searched htaccess dynamic subdomains and it came up with loads lol. ty +rep

timROGERS
30-12-2007, 06:13 PM
Thank you very much! I've actually been looking for this! :D

lolwut
30-12-2007, 07:03 PM
WRITE A TUTORIAL ^_^
Nice one.

Florx
30-12-2007, 07:05 PM
I posted how to do it above. :)

Want to hide these adverts? Register an account for free!