You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Antonio Piu <an...@italocalvino.it> on 2007/11/12 17:46:19 UTC
[users@httpd] domain.com/~user -> user.domain.com
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.
---
Antonio
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] domain.com/~user -> user.domain.com
Posted by Antonio Piu <an...@italocalvino.it>.
>
> >> 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/
> >
> > From http://www.easymodrewrite.com/example-subdomains without having
> > tested it, this should work:
> >
> > RewriteEngine On
> > RewriteBase /
> > RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
> > RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com$ [NC]
> > RewriteRule (.*) ~%2/$1 [L]
> >
>
It works like a charm! thankyou a lot!
>
>
> >
> >
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> > Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > " from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] domain.com/~user -> user.domain.com
Posted by Craig Huffstetler <cr...@gmail.com>.
According to the page referenced:
http://www.easymodrewrite.com/example-subdomains
*"This code should be placed in the htaccess file in the root of your
domain, i.e.* domain.com/.htaccess"
.....
On Nov 12, 2007 1:30 PM, Antonio Piu <an...@italocalvino.it> wrote:
> >> 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/ <http://www.domain.com/%7Euser/>
> >
> > From http://www.easymodrewrite.com/example-subdomains without having
> > tested it, this should work:
> >
> > RewriteEngine On
> > RewriteBase /
> > RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
> > RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com$ [NC]
> > RewriteRule (.*) ~%2/$1 [L]
> >
>
> Thanks! but where I have to put this code? In which .htaccess?
>
>
> >
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> > Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > " from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: [users@httpd] domain.com/~user -> user.domain.com
Posted by Chris Arnold <ca...@electrichendrix.com>.
>>Thanks! but where I have to put this code? In which .htaccess?
I too would like to use this but when i put it in my htaccess file, it does not work. Here is my htaccess with the supplied code in it. Maybe i am not finding the right place to place this code?
<Limit GET>
order allow,deny
allow from all
deny from 81.177.14.
deny from 81.177.15.
deny from 85.255.119.
deny from 208.66.193.
deny from 195.225.177.
</Limit>
<Limit POST>
order allow,deny
allow from all
deny from 81.177.14.
deny from 81.177.15.
deny from 208.66.193.
</Limit>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com$ [NC]
RewriteRule (.*) ~%2/$1 [L]
</IfModule>
# END WordPress
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] domain.com/~user -> user.domain.com
Posted by Antonio Piu <an...@italocalvino.it>.
>> 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/
>
> From http://www.easymodrewrite.com/example-subdomains without having
> tested it, this should work:
>
> RewriteEngine On
> RewriteBase /
> RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
> RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com$ [NC]
> RewriteRule (.*) ~%2/$1 [L]
>
Thanks! but where I have to put this code? In which .htaccess?
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] domain.com/~user -> user.domain.com
Posted by Martijn <sw...@googlemail.com>.
On Nov 12, 2007 4:46 PM, Antonio Piu <an...@italocalvino.it> wrote:
> 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/
>From http://www.easymodrewrite.com/example-subdomains without having
tested it, this should work:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com$ [NC]
RewriteRule (.*) ~%2/$1 [L]
Martijn.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org