domain.com/~user ---> user.domain.com
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > domain.com/~user ---> user.domain.com




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

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


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-12-07 06: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.






[ Post a follow-up to this message ]



    Re: domain.com/~user ---> user.domain.com  
Rik Wasmus


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-12-07 06: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





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:13 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register