domain.com/users/username/ to a physical subdomain account?

Using a single web hosting account to host multiple sites

domain.com/users/username/ to a physical subdomain account?

Postby malmklang » Fri Apr 06, 2007 6:34 pm

This shouldn't be a mod_rewrite issue, but seems to be since redirecting without rewrite appears impossible when the new sub domain account is outside of the root folder on my host.

This is it:
I host a few users, I do not run my own server. I have been using a perl engine to allow uploads and file creation but now I have access to unlimited subdomains and respective ftp.accounts. I would now like to offer my users the more eye-friendly url of:
user.domain.com
instead of the old:
domain.com/users/user/

But this doesn't work since the subdomains are created outside of my own www folder, ls shows mail subdomains www:
Code: Select all
Redirect 301 / http://user.domain.com/

I put it into a .htaccess and slided it into the actual users/user folder and get a wierd user.domain.com/users/user don't exist on this server.
Tried backracking also with ../../ without any luck.

So, is there a way with mod_rewrite or am I doing something wrong with the non-mod_rewrite thing?

Btw, the users folders have subfolders and stuff, and I want a redirect or a rewrite to catch everything requested from the old folder and serve it from the subdomain in the same structure as before, only, duh, on the subdomain :P

Thanks ;)
malmklang
 
Posts: 17
Joined: Mon Mar 12, 2007 6:54 am

Postby richardk » Sat Apr 07, 2007 12:39 pm

Could you provide an example of the document root of a sub domain and your main document root.

Mod_rewrite cannot rewrite to higher directories outside of the current document root, for example from /.../abc (sub domain document root) to /.../main/users/abc (where /.../main is the main document root).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby malmklang » Sat Apr 07, 2007 3:22 pm

home/malmklan
Gives a ls of
Code: Select all
mail
www
subdomains
.links
etc.....

Which means that mod_rewrite is out of the question, from what you wrote, rk.
I suspected it would be. Now, this is not the right forum then, but if you know any other solution, please give me a pointer in the general direction of some tuts using other apache modules. I'll google all that I can meanwhile :)

I've set up custom htaccess error docs to solve the problem temporarily, may end up being the permanent solution as well, where any 403 or 404 gives a list of "Are you looking for domain.com/users/user? Try user.domain.com instead. Not smooth but it does the jib at least :)
malmklang
 
Posts: 17
Joined: Mon Mar 12, 2007 6:54 am

Postby richardk » Sun Apr 08, 2007 12:25 pm

You would probably need access to the httpd.conf file to do this, so you should probably ask your host.

Also see if you can create symlinks, then you could create a symlink from the sub domain document root to the current /users/user directory.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby malmklang » Mon Apr 09, 2007 7:34 am

RedirectMatch was my uncle ;)

Code: Select all
RedirectMatch 301 /hp/([0-9a-zA-Z]+)(/[0-9a-zA-Z]+) http://$1.domain.com
malmklang
 
Posts: 17
Joined: Mon Mar 12, 2007 6:54 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 43 guests

cron