Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite from one subdomain to another

is this possible?

         

chemoul

6:57 am on Jul 28, 2005 (gmt 0)

10+ Year Member



Hi,

I've done some work in mod_rewrite but I'm currently facing a problem that I don't know how to solve - and whether the best way to tackle it is with mod_rewrite or not.
I have an empty subdomain empty.domain.com
I would like to place a .htaccess file in this subdomain that directs all requests to root (http://www.empty.domain.com/) or index.htm (http://www.empty.domain.com/index.htm) to a different subdomain notempty.domain.com
A permanent redirect is not really an option because I would like this redirection to be transparent, and I will have to pass parameters to the scripts located at notempty.domain.com

The whole idea behind this is to be able to create multiple subdomains that use one and the same php application with different categories for each subdomain. For example, a database holds articles in different categories. The php application pulls the articles out of the database and formats them. The different subdomains should then be used to display a category.

Any ideas?

Thank you for your help.

Cheers,
Stefan

jdMorgan

2:32 am on Jul 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It seems to me that using Apache's ScriptAlias or using symlinks is the way to go if you can't get your rewrite to work. It all depends on how your subdomains are set up; If you defined the subdomains to point to the same directory as your main domain, then it should just work. If you used cPanel or defined the subdomains in httpd.conf, then you'll probably need to modify httpd.conf or add symlinks to make this work.

Jim