You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by la...@tidtilforandring.dk on 2008/02/06 15:01:48 UTC

URL rewriting and mod_jk


 Hi,
 when I use the following:
 Options +FollowSymLinks
 RewriteEngine on
 RewriteRule ^/news/([0-9]+)$ /news/$1/ [R]
 RewriteRule ^/news/([0-9]+)/$ /news.jsp?id=$1
 and I use this URL:
 http://localhost/news/1
 apache-tomcat displays the jsp-page - with source code (html and jsp
code).
 I am using apache-2.2.8 and apache-tomcat-6.0.14 and mod_jk.
 JkAutoAlias    /opt/apache-tomcat-6.0.14/webapps/domainname
 JkMount        /*.jsp default
 JkMount        /*.* default
 JkMount        /servlet/* default  

 As mentioned on several web sites I have loaded mod_jk before
mod_rewrite.   

 What is wrong?  

 Thanks, Lars 

[OT] Re: URL rewriting and mod_jk

Posted by Rainer Jung <ra...@kippdata.de>.
Hi lars,

you can match against QUERY_STRING in RewriteCond and then use the match 
via %N in the replacement part of the RewriteRule.

See "QUERY_STRING" and "%N" in the docs page of mod_rewrite.

For more special mod_rewrite questions not directly related to mod_jk or 
Tomcat interoperability, the httpd user list would be a better place.

Regards,

Rainer

Lars Nielsen Lind wrote:
> Hi Rainer, and thanks for your reply.
> 
> The [PT] at the end of the line seems to be the 'trick'.
> 
> I have another question:
> 
> If the user enters: http://www.domainname.dk/news/news.jsp?id=5, is 
> there then any way to force the url to change to: 
> http://www.domainname.dk/news/news/5/ ?
> 
> thanks,
> 
> Lars
> 
> 
> Rainer Jung skrev:
>> Hi Lars,
>>
>> most liekly you need to set the pass through flag "PT" for the rewrite 
>> rules.
>>
>> See also "pass through" in
>>
>> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
>>
>> Also: if you are using VirtualHosts, you need to put the JkMount into 
>> the VirtualHosts.
>>
>> Let us know, if that works.
>>
>> Regards,
>>
>> Rainer
>>
>> lanili@tidtilforandring.dk wrote:
>>>
>>>  Hi,
>>>  when I use the following:
>>>  Options +FollowSymLinks
>>>  RewriteEngine on
>>>  RewriteRule ^/news/([0-9]+)$ /news/$1/ [R]
>>>  RewriteRule ^/news/([0-9]+)/$ /news.jsp?id=$1
>>>  and I use this URL:
>>>  http://localhost/news/1
>>>  apache-tomcat displays the jsp-page - with source code (html and jsp
>>> code).
>>>  I am using apache-2.2.8 and apache-tomcat-6.0.14 and mod_jk.
>>>  JkAutoAlias    /opt/apache-tomcat-6.0.14/webapps/domainname
>>>  JkMount        /*.jsp default
>>>  JkMount        /*.* default
>>>  JkMount        /servlet/* default  As mentioned on several web sites 
>>> I have loaded mod_jk before
>>> mod_rewrite.   What is wrong?  Thanks, Lars 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL rewriting and mod_jk

Posted by Lars Nielsen Lind <la...@tidtilforandring.dk>.
Hi Rainer, and thanks for your reply.

The [PT] at the end of the line seems to be the 'trick'.

I have another question:

If the user enters: http://www.domainname.dk/news/news.jsp?id=5, is 
there then any way to force the url to change to: 
http://www.domainname.dk/news/news/5/ ?

thanks,

Lars


Rainer Jung skrev:
> Hi Lars,
>
> most liekly you need to set the pass through flag "PT" for the rewrite 
> rules.
>
> See also "pass through" in
>
> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
>
> Also: if you are using VirtualHosts, you need to put the JkMount into 
> the VirtualHosts.
>
> Let us know, if that works.
>
> Regards,
>
> Rainer
>
> lanili@tidtilforandring.dk wrote:
>>
>>  Hi,
>>  when I use the following:
>>  Options +FollowSymLinks
>>  RewriteEngine on
>>  RewriteRule ^/news/([0-9]+)$ /news/$1/ [R]
>>  RewriteRule ^/news/([0-9]+)/$ /news.jsp?id=$1
>>  and I use this URL:
>>  http://localhost/news/1
>>  apache-tomcat displays the jsp-page - with source code (html and jsp
>> code).
>>  I am using apache-2.2.8 and apache-tomcat-6.0.14 and mod_jk.
>>  JkAutoAlias    /opt/apache-tomcat-6.0.14/webapps/domainname
>>  JkMount        /*.jsp default
>>  JkMount        /*.* default
>>  JkMount        /servlet/* default 
>>  As mentioned on several web sites I have loaded mod_jk before
>> mod_rewrite.  
>>  What is wrong? 
>>  Thanks, Lars 
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL rewriting and mod_jk

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Lars,

most liekly you need to set the pass through flag "PT" for the rewrite 
rules.

See also "pass through" in

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

Also: if you are using VirtualHosts, you need to put the JkMount into 
the VirtualHosts.

Let us know, if that works.

Regards,

Rainer

lanili@tidtilforandring.dk wrote:
> 
>  Hi,
>  when I use the following:
>  Options +FollowSymLinks
>  RewriteEngine on
>  RewriteRule ^/news/([0-9]+)$ /news/$1/ [R]
>  RewriteRule ^/news/([0-9]+)/$ /news.jsp?id=$1
>  and I use this URL:
>  http://localhost/news/1
>  apache-tomcat displays the jsp-page - with source code (html and jsp
> code).
>  I am using apache-2.2.8 and apache-tomcat-6.0.14 and mod_jk.
>  JkAutoAlias    /opt/apache-tomcat-6.0.14/webapps/domainname
>  JkMount        /*.jsp default
>  JkMount        /*.* default
>  JkMount        /servlet/* default  
> 
>  As mentioned on several web sites I have loaded mod_jk before
> mod_rewrite.   
> 
>  What is wrong?  
> 
>  Thanks, Lars 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org