You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dennis <ar...@yahoo.com.cn> on 2011/11/25 12:46:28 UTC

[users@httpd] A rewrite rule

Hi, guys,
I want to rewrite from "tc.example.com/xyz" to "example.com/good/tc"
I tried the following rewrite rule, but it doesnot work.
RewriteCond %{HTTP_HOST} \.tc\.example\.com$RewriteRule ^/(.*) /good/$1 [NC,P,L]
Any idea how to do it?
Thanks.Dennis

Re: [users@httpd] A rewrite rule

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Thanks, Igor,

There's two Igors on this List
I am not a beautiful unique snowflake :-/

> I want the url in user's browser looks like "tc.example.com/what", so
> a 302 redirect is not ok.
> 
> 
> Any other way to do this?
> Dennis

A I already wrote:

  Essentially you want to do reverse proxying.

  http://www.apachetutor.org/admin/reverseproxies




> --- On Fri, 11/25/11, Igor Cicimov <ic...@gmail.com> wrote:
> 
> 
> 
> From: Igor Cicimov <ic...@gmail.com>
> Subject: Re: [users@httpd] A rewrite rule
> To: users@httpd.apache.org
> Date: Friday, November 25, 2011, 8:06 PM
> 
> 
> Is this working?
> 
> 
> 
> RewriteCond %{HTTP_HOST} \.tc\.example\.com$
> RewriteRule ^/(.*)$ http://example.com/good/tc/$1 [R,L]
> 
> or you just want anything to go to /good/tc ?
> 
> 
> 
> RewriteCond %{HTTP_HOST} \.tc\.example\.com$
> RewriteRule ^/.* http://example.com/good/tc [R,L]
> 
> 
> 
> On Fri, Nov 25, 2011 at 10:46 PM, Dennis < arsenepark@yahoo.com.cn >
> wrote:
> 
> 
> 
> Hi, guys,
> 
> 
> I want to rewrite from " tc.example.com/xyz " to "
> example.com/good/tc "
> 
> 
> I tried the following rewrite rule, but it doesnot work.
> 
> 
> RewriteCond %{HTTP_HOST} \.tc\.example\.com$
> RewriteRule ^/(.*) /good/$1 [NC,P,L]
> 
> 
> Any idea how to do it?
> 
> 
> Thanks.
> Dennis
> 

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

---------------------------------------------------------------------
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] A rewrite rule

Posted by Dennis <ar...@yahoo.com.cn>.
Thanks, Igor, 
I want the url in user's browser looks like "tc.example.com/what", so a 302 redirect is not ok.
Any other way to do this?Dennis

--- On Fri, 11/25/11, Igor Cicimov <ic...@gmail.com> wrote:

From: Igor Cicimov <ic...@gmail.com>
Subject: Re: [users@httpd] A rewrite rule
To: users@httpd.apache.org
Date: Friday, November 25, 2011, 8:06 PM

Is this working?



RewriteCond %{HTTP_HOST} \.tc\.example\.com$
RewriteRule ^/(.*)$ http://example.com/good/tc/$1 [R,L]

or you just want anything to go to /good/tc ?




RewriteCond %{HTTP_HOST} \.tc\.example\.com$
RewriteRule ^/.* http://example.com/good/tc [R,L]




On Fri, Nov 25, 2011 at 10:46 PM, Dennis <ar...@yahoo.com.cn> wrote:

Hi, guys,
I want to rewrite from "tc.example.com/xyz" to "example.com/good/tc"

I tried the following rewrite rule, but it doesnot work.
RewriteCond %{HTTP_HOST} \.tc\.example\.com$
RewriteRule ^/(.*) /good/$1 [NC,P,L]
Any idea how to do it?

Thanks.Dennis


Re: [users@httpd] A rewrite rule

Posted by Igor Cicimov <ic...@gmail.com>.
Is this working?


RewriteCond %{HTTP_HOST} \.tc\.example\.com$
RewriteRule ^/(.*)$ http://example.com/good/tc/$1 [R,L]

or you just want anything to go to /good/tc ?


RewriteCond %{HTTP_HOST} \.tc\.example\.com$
RewriteRule ^/.* http://example.com/good/tc [R,L]



On Fri, Nov 25, 2011 at 10:46 PM, Dennis <ar...@yahoo.com.cn> wrote:

> Hi, guys,
>
> I want to rewrite from "tc.example.com/xyz" to "example.com/good/tc"
>
> I tried the following rewrite rule, but it doesnot work.
>
> RewriteCond %{HTTP_HOST} \.tc\.example\.com$
> RewriteRule ^/(.*) /good/$1 [NC,P,L]
>
> Any idea how to do it?
>
> Thanks.
> Dennis
>

Re: [users@httpd] A rewrite rule

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> 
> Hi, guys,
> 
> 
> I want to rewrite from "tc.example.com/xyz" to "example.com/good/tc"

Essentially you want to do reverse proxying.

http://www.apachetutor.org/admin/reverseproxies

> I tried the following rewrite rule, but it doesnot work.
> 
> 
> RewriteCond %{HTTP_HOST} \.tc\.example\.com$
> RewriteRule ^/(.*) /good/$1 [NC,P,L]
> 
> 
> Any idea how to do it?
> 
> 
> Thanks.
> Dennis

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

---------------------------------------------------------------------
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