André Warnier wrote:
Felix Schumacher wrote:
Am 19.02.2015 um 21:41 schrieb André Warnier:
Jérémie Barthés wrote:
...
...


in the browser, you have to modify your rewrite rules, perhaps by using a RewriteCond with the -d flag, to check first if the URL points to an existing directory, and if yes add the terminating "/" yourself (with a RewriteRule) before other rewrite tests/rules take place.
This rewrite.config

# if path doesn't end with a slash redirect it to an url with an ending slash
RewriteCond    %{REQUEST_URI} !^.*/$
RewriteRule    ^/mypath/(.*)$    /mypath/$1/ [R]

# every path ending on a slash forward to /examples/...
RewriteRule    ^/mypath/(.*/)$    /examples/jsp/$1

will do the trick. I think -d will not work, since /mypath/async is not existant, it only "feels" like a directory.

Aaah yes, correct. Good catch. Maybe that is why I sub-consciously inserted the word "perhaps" above.. ;-)


Actually, upon further examination, I don't think that the rules above will work correctly. Because

>> RewriteCond    %{REQUEST_URI} !^.*/$
>> RewriteRule    ^/mypath/(.*)$    /mypath/$1/ [R]

would also rewrite

   /mypath/my-nifty.jsp

to

   /mypath/my-nifty.jsp/

which is probably not what is intended.
Back to the drawing board..

Maybe adding a prior

RewriteCond  %{REQUEST_URI} !\.(html|jpg|gif|jsp)$
and then
RewriteCond    %{REQUEST_URI} !^.*/$
RewriteRule    ^/mypath/(.*)$    /mypath/$1/ [R]

RewriteRule    ^/mypath/(.*)$    /examples/jsp/$1

would do it ?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to