You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by caesarkim <ca...@hotmail.com> on 2008/11/26 17:49:24 UTC

[users@httpd] quesiton for Apache url rewrite module

I am trying to use url rewrite module, but i am not familar with it.

I want to rewrite any request (http://localhost/clusterjsp/*.jsp) to be
http://localhost/*.jsp. 

Can anybody tell me how to do this?

Thanks.


-- 
View this message in context: http://www.nabble.com/quesiton-for-Apache-url-rewrite-module-tp20704719p20704719.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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] quesiton for Apache url rewrite module

Posted by Tom Evans <te...@googlemail.com>.
On Thu, 2008-11-27 at 07:38 -0500, Eric Covener wrote:
> > RewriteCond %{REQUEST_URI} ^/[^\/\.]*\.jsp       # is the url like /foo.jsp
> 
> OT, but FWIW your / never needs escaping (because it's not a delimeter
> in the regex in httpd), and inside the character  the "." is taken
> literally as well,
> 

Thanks! I was only testing it with perl one liners, but good info :)

Cheers

Tom


---------------------------------------------------------------------
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] quesiton for Apache url rewrite module

Posted by Eric Covener <co...@gmail.com>.
> RewriteCond %{REQUEST_URI} ^/[^\/\.]*\.jsp       # is the url like /foo.jsp

OT, but FWIW your / never needs escaping (because it's not a delimeter
in the regex in httpd), and inside the character  the "." is taken
literally as well,

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] quesiton for Apache url rewrite module

Posted by Tom Evans <te...@googlemail.com>.
On Wed, 2008-11-26 at 09:56 -0800, caesarkim wrote:
> Yes. I want the latter.
> 
> 
> 
> Tom Evans-3 wrote:
> > 
> > On Wed, 2008-11-26 at 08:49 -0800, caesarkim wrote:
> >> I am trying to use url rewrite module, but i am not familar with it.
> >> 
> >> I want to rewrite any request (http://localhost/clusterjsp/*.jsp) to be
> >> http://localhost/*.jsp. 
> >> 
> >> Can anybody tell me how to do this?
> >> 
> >> Thanks.
> >> 
> >> 
> > 
> > To clarify, do you want users to go to
> > http://localhost/clusterjsp/foo.jsp and be served the page
> > http://localhost/foo.jsp or do you want users to go to
> > http://localhost/foo.jsp and be served the page
> > http://localhost/clusterjsp/foo.jsp ? You asked for the former, but I
> > think you actually wanted the latter.
> > 
> > Cheers
> > 
> > Tom
> > 

RewriteCond %{REQUEST_URI} ^/[^\/\.]*\.jsp       # is the url like /foo.jsp
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f  # if that file doesnt exist
RewriteRule ^/(.*\.jsp) /clusterjsp/$1 [L]       # redirect to /clusterjsp/foo.jsp          

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


---------------------------------------------------------------------
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] quesiton for Apache url rewrite module

Posted by caesarkim <ca...@hotmail.com>.
Yes. I want the latter.



Tom Evans-3 wrote:
> 
> On Wed, 2008-11-26 at 08:49 -0800, caesarkim wrote:
>> I am trying to use url rewrite module, but i am not familar with it.
>> 
>> I want to rewrite any request (http://localhost/clusterjsp/*.jsp) to be
>> http://localhost/*.jsp. 
>> 
>> Can anybody tell me how to do this?
>> 
>> Thanks.
>> 
>> 
> 
> To clarify, do you want users to go to
> http://localhost/clusterjsp/foo.jsp and be served the page
> http://localhost/foo.jsp or do you want users to go to
> http://localhost/foo.jsp and be served the page
> http://localhost/clusterjsp/foo.jsp ? You asked for the former, but I
> think you actually wanted the latter.
> 
> Cheers
> 
> Tom
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/quesiton-for-Apache-url-rewrite-module-tp20704719p20705982.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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] quesiton for Apache url rewrite module

Posted by Tom Evans <te...@googlemail.com>.
On Wed, 2008-11-26 at 08:49 -0800, caesarkim wrote:
> I am trying to use url rewrite module, but i am not familar with it.
> 
> I want to rewrite any request (http://localhost/clusterjsp/*.jsp) to be
> http://localhost/*.jsp. 
> 
> Can anybody tell me how to do this?
> 
> Thanks.
> 
> 

To clarify, do you want users to go to
http://localhost/clusterjsp/foo.jsp and be served the page
http://localhost/foo.jsp or do you want users to go to
http://localhost/foo.jsp and be served the page
http://localhost/clusterjsp/foo.jsp ? You asked for the former, but I
think you actually wanted the latter.

Cheers

Tom


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