Apache Server configuration support - domain.com/~user ---> user.domain.com

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > November 2007 > domain.com/~user ---> user.domain.com





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author domain.com/~user ---> user.domain.com
policleto@gmail.com

2007-11-12, 1:34 pm

Hello,

I am new to this forum (found it via Google). Please forgive that I
just snow in like that, but I have a rewrite problem, which
a .htaccess Guru can maybe solve in a few minutes. - I wasted already
some days, but it still doesn't work.

Want I want to do is the following:

If someone accesses http://user.domain.com/ he shall be redirected to
http://www.domain.com/~user/

Similarly, all accesses under the subdomain shall be redirected, too,
e. g. http://user.domain.com/dogs/cats.html should retrieve
http://www.domain.com/~user/dogs/cats.html

The subdomain entry should remain in the URL field of the browser, i.
e. the redirect should be "hidden".

The reason why I need this, is that, when I create a user web/FTP
account, the URL to it is http://www.domain.com/~user/, and I would
like to assign a http://user.domain.com/ subdomain to them.

Let me give you the background of the directory structure:

http://www.domain.com/ points to the path:
/home/www/web12/web

http://www.domain.com/~user/ points to the path:
/home/www/web12/user/domain.com_user/web
and
http://user.domain.com/ should points to the same path.

So basically, the .htaccess file would have to direct HTTP file
accesses http://user.domain.com/* to http://www.domain.com/~user/*
respectively.

But as the entry in the URL field in the browser shall not change, one
would have to work with the paths, if I understand it correctly?

Does somebody know a solution to this problem (rewrite condition &
rewrite rule)? I'd hang his picture up in my living room.

Kind regards,
Antonio.

Rik Wasmus

2007-11-12, 1:34 pm

On Mon, 12 Nov 2007 17:33:57 +0100, <policleto@gmail.com> wrote:

> Hello,
>
> I am new to this forum


This is usenet, not really a forum...

> (found it via Google). Please forgive that I
> just snow in like that, but I have a rewrite problem, which
> a .htaccess Guru can maybe solve in a few minutes. - I wasted already
> some days, but it still doesn't work.
>
> Want I want to do is the following:
>
> If someone accesses http://user.domain.com/ he shall be redirected to
> http://www.domain.com/~user/
>
> Similarly, all accesses under the subdomain shall be redirected, too,
> e. g. http://user.domain.com/dogs/cats.html should retrieve
> http://www.domain.com/~user/dogs/cats.html
>
> The subdomain entry should remain in the URL field of the browser, i.
> e. the redirect should be "hidden".


> So basically, the .htaccess file would have to direct HTTP file
> accesses http://user.domain.com/* to http://www.domain.com/~user/*
> respectively.


Something like this (untested, never worked with users like that..)?

RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^(.*+)\.example\.com
RewriteRule ^(.*)$ /~%1/$1 [QSA]
--
Rik
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com