Rewriting from a subdomain to the main domain

Using a single web hosting account to host multiple sites

Rewriting from a subdomain to the main domain

Postby AbuAaminah » Fri Mar 27, 2009 10:20 am

Is it possible to rewrite the following:

something.domain.com/bla-bla

as

www.domain.com/file.php?sub=something&page=bla-bla

???
AbuAaminah
 
Posts: 40
Joined: Mon Dec 08, 2008 6:31 pm

Postby richardk » Fri Mar 27, 2009 12:46 pm

FAQ: Virtual sub domains. The last part.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby AbuAaminah » Fri Mar 27, 2009 1:02 pm

Did I ever tell you that if you weren't a man, I would kiss you?

Now, tell me... do I actually need to create those subdomains?
AbuAaminah
 
Posts: 40
Joined: Mon Dec 08, 2008 6:31 pm

Postby richardk » Fri Mar 27, 2009 1:09 pm

Yes, they need DNS records. You could use Wildcard DNS.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby AbuAaminah » Fri Mar 27, 2009 7:10 pm

But do I need to create the subdirectories (as would normally be the case) or do I point them at the main folder?

Thanks
AbuAaminah
 
Posts: 40
Joined: Mon Dec 08, 2008 6:31 pm

Postby AbuAaminah » Fri Mar 27, 2009 7:27 pm

Also, the redirect doesn't work!!! Rewrite is on ( i did your test), but this one doesn't rewrite. Any ideas?

I'm testing on my localhost (WinXP) if that's of any help.
AbuAaminah
 
Posts: 40
Joined: Mon Dec 08, 2008 6:31 pm

Postby AbuAaminah » Fri Mar 27, 2009 9:41 pm

One other thing is that I can identify the subdomain via PHP, so its just the main rewrite I'm after (i.e. without needing to grab the subdomain).

But either will do though.

Thanks
AbuAaminah
 
Posts: 40
Joined: Mon Dec 08, 2008 6:31 pm

Postby AbuAaminah » Fri Mar 27, 2009 10:55 pm

Following on, I've just realised that all I need to do is just point the subdomain to the root directory and then use php to grab the subdomain!

Thanks for your help.
AbuAaminah
 
Posts: 40
Joined: Mon Dec 08, 2008 6:31 pm

Postby richardk » Sat Mar 28, 2009 8:39 am

You could/should use the edit button.

But do I need to create the subdirectories (as would normally be the case) or do I point them at the main folder?

Point them to the directory containing the .htaccess file and mod_rewrite.

Also, the redirect doesn't work!!! Rewrite is on ( i did your test), but this one doesn't rewrite. Any ideas?

What exactly are you doing?
What URL are you visiting?
What mod_rewrite do you have?
What is the sub domain's document root?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 0 guests

cron