Subdomain folder to root

Using a single web hosting account to host multiple sites

Subdomain folder to root

Postby iQ.mind » Thu Jan 31, 2008 12:34 pm

Hi everybody. I really need some help.
I'm new to mod_rewrite.

I got some domain example.com
and subdomain sub.example.com

When I create subdomains, my host's system creates subfolders for them in site root.
For example, example.com is in www, and sub.example.com is in www/sub.
I need to make all request to www/sub be internally redirected to www/index.php in the filesystem level, not url.
User should see sub.example.com, but in system it should be like example.com. My CMS will serve request depending on url, not file system.
And I have no access to vhosts configuration.

I tried to do that without mod_rewrite by creating symlink www/sub to point to www and it works on my configuration, but host's system doesn't like my idea.

So I need to make it work like symlinks I described but by rewrite module.

Please help!
And sorry for English, it's not my native language.
Regargs.
iQ.mind
 
Posts: 4
Joined: Thu Jan 31, 2008 12:20 pm

Postby richardk » Thu Jan 31, 2008 3:47 pm

You can't rewrite from /www/sub to /www. Put an index.php file in /www/sub and include the /www/index.php file.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby iQ.mind » Thu Jan 31, 2008 11:36 pm

Thanks!

I've resolved this problem as you suggest:

Code: Select all
<?php
chdir('..');
include 'index.php';
iQ.mind
 
Posts: 4
Joined: Thu Jan 31, 2008 12:20 pm

Postby iQ.mind » Fri Feb 01, 2008 12:37 am

Hm... It worked nice at my configuration, but not at host's.
Any other idea?
iQ.mind
 
Posts: 4
Joined: Thu Jan 31, 2008 12:20 pm

Postby iQ.mind » Fri Feb 01, 2008 3:03 am

I've solved the problem! It was another problem, not in script or some!
Anyway, thanks!
iQ.mind
 
Posts: 4
Joined: Thu Jan 31, 2008 12:20 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 19 guests

cron