You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Charles Li <cl...@yahoo.com> on 2008/02/12 21:32:44 UTC

[users@httpd] help with redirect base on context

I would like to redirect base on the context:

When user access my server with the following:

http://server/outside

I would like to redirect them to another site.
I try the following, but did not get it work.

    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^/outside$   [NC]
    RewriteRule ^/$ http://server/basic.jsp [R]

It just gives me a page not found 404.
Please can yo point out what am I doing wrong?

Thanks.



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


---------------------------------------------------------------------
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] help with redirect base on context

Posted by Joshua Slive <jo...@slive.ca>.
On Feb 12, 2008 3:32 PM, Charles Li <cl...@yahoo.com> wrote:
> I would like to redirect base on the context:
>
> When user access my server with the following:
>
> http://server/outside
>
> I would like to redirect them to another site.
> I try the following, but did not get it work.
>
>     RewriteEngine on
>     RewriteCond %{REQUEST_URI} ^/outside$   [NC]
>     RewriteRule ^/$ http://server/basic.jsp [R]
>
> It just gives me a page not found 404.
> Please can yo point out what am I doing wrong?

The regex in the RewriteRule matches ONLY /, thereby contradicting the
RewriteCond. It sounds like you just want
RewriteRule ^/outside$ http://server/basic.jsp [R]

Use the RewriteLog to see what mod_rewrite is doing.

Joshua.

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