Forum Moderators: phranque

Message Too Old, No Replies

Managed subdomain

Managed subdomains in public folder and rewrited index

         

Folks

5:56 pm on Sep 27, 2009 (gmt 0)

10+ Year Member



Hi i want redirect/rewrite main domain to folder under public domain but without changes in URI, how on it?

root Directory Tree:

Folders - look like as
------------------------------------
main - main domain as: www.example.com (i don't want www.example.com/main or main.example.com)
sub1 - subdomain as: sub1.example.com
sub2 - subdomain as: sub2.example.com
forum - subdomain as: forum.example.com
beta - subdomain as: beta.example.com
.htacces - apache file

Thank you so much, i spend too much time on it without success or relevant result.

of course i need code what work with folders in subdomains: "sub1.example.com/some_folder", one time i get it but without these folders...

jdMorgan

1:42 pm on Sep 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We've covered this subject fairly thoroughly here in previous posts. Try searching WebmasterWorld (see link at top of this page) for the keywords "Rewrite subdomain subdirectory RewriteRule RewriteCond HTTP_HOST" to turn up many previous threads.

Note that you will be much happier in the long run if you put all subdomain-subdirectories in a separate subdirectory. This makes for easier maintenance, fewer restrictions on root directory folder and subdomain naming, and much more efficient rule processing.

In other words, put all "subdomain-subdirectories" into a directory named something like "/subs" -- Use /subs/sub1, /subs/sub2, /subs/forum, /subs/beta. In this way, your rule(s) need only test for "/subs/" to be sure that the request has not already been rewritten, making loop prevention much easier, and avoiding most future restrictions on the names of your subdomains.

Jim