You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by pe...@kisstechnologies.co.uk on 2004/02/02 17:47:12 UTC

URL rewriting and context paths

Hi,

Im trying to use url rewriting (in this case ISAPI Redirect) to translate 
a search engine friendly URL (ie xyz.com/123_keyword_product_name.html) 
into a tomcat one (xyz.com/app/product.do?id=123).  This all works fine 
and dandy however there is a big problem with it.  One of the uses I have 
is to map tomcat applications to the root context as far as the URL is 
concerned, but leave them under another context within tomcat itself.
I use a shared tomcat server for several applications so they cant all be 
on the root, but reponses to search engines are a lot better if the URL 
appears that way.  The problem is that in the above example, the Tomcat 
server responds with "Set-Cookie: JSESSIONID=132456789; Path=/app".  This 
Path is of course that of the context path of the application.  The 
browser doesnt thus send this cookie with the next request because the 
request appears to be to the / path;  Tomcat thus gets a new request with 
no session ID and issues another one again to /app.
Is there any way I can force the session cookie to be written to the root 
context instead of the context of the application?

thanks
Pete Storey

Kiss Technologies

http://www.kisstechnologies.co.uk/

4, Percy Street
London
W1T 1DF

Phone numbers:

Phone 020 7692 9922
Fax 020 7692 9923
Out of hours
Support phone 020 7692 9933

Re: URLRewrite help needed

Posted by Duane Burchell <bu...@engsoc.org>.
I need to pay better attention to what I type.

> As I understand it, the steps would be :
> 1 ) Download the jar files and put them into a urlrewrite directory off
> the WEB-INF directory.

This should read :
1)  Download the jar files, which will extract into a lib subdirectory off
the WEB-INF directory.  The urlrewrite.xml and web.xml files are in the
WEB-INF directory.

Sorry.
- Duane

> 2)  Alter the web.xml file to include this filter (using code straight
> form the tuckey.org site)
> 3)  Alter the urlrewrite file to include the rules that I want (some basic
> substitutions from google-searchable URLs ex.  /pageid/ ->  &pageid= )
> 4)  Restart tomcat.
>
> However, as soon as I add the filter code into the web.xml file, all
> requests return a 404 error (whether the request uses the filter or not).
>
> This seems like such an easy task, but I can't get it to work.  If anybody
> can please point out something I'm overlooking, I would appreciate it.
>
> I'm using tomcat 4.1 on Win2K server.
>
> Thanks,
> Duane
k

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


URLRewrite help needed

Posted by Duane Burchell <bu...@engsoc.org>.
Hello
I'm relatively new to using Tomcat, and need help with what (should be) an
easy task.  I've searched through the archives, but haven't found the
information I need.

I'm basically trying to do a mod_rewrite, but using tomcat (without apache
installed).  I've read up on the tuckey.org/urlrewrite, and this
filter seems to handle exactly what I want.  But I can't get it to work.

As I understand it, the steps would be :
1 ) Download the jar files and put them into a urlrewrite directory off
the WEB-INF directory.
2)  Alter the web.xml file to include this filter (using code straight
form the tuckey.org site)
3)  Alter the urlrewrite file to include the rules that I want (some basic
substitutions from google-searchable URLs ex.  /pageid/ ->  &pageid= )
4)  Restart tomcat.

However, as soon as I add the filter code into the web.xml file, all
requests return a 404 error (whether the request uses the filter or not).

This seems like such an easy task, but I can't get it to work.  If anybody
can please point out something I'm overlooking, I would appreciate it.

I'm using tomcat 4.1 on Win2K server.

Thanks,
Duane

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org