Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable support for the REQUEST_URI and REQUEST_FILENAME based rewrite conditions #49

Closed
GoogleCodeExporter opened this issue Jul 5, 2015 · 8 comments

Comments

@GoogleCodeExporter
Copy link

REQUEST_URI based rewrite conditions are not supported yet in the apache
style configuration. This should be supported.

Supporting REQUEST_FILENAME might not be a bad idea either. This represents
the full local filesystem path to the file or script matching the request.
On the LAMP stack of applications, this is a typical way of rewriting when
the condition is evaluated to be either a file name or a directory name. 

For the Xml style configuration, this can supported as
<rule>
<condition name="request-filename">some-javascript-file.js</condition>
<from>/js/(*).js</from>
<to>/servlet/my-file-servlet-and-access-logger.jsp?file=$1</to>
</rule>

For the Apache style configuration, this can be supported as
RewriteCond %{REQUEST_FILENAME} some-javascript-file.js
RewriteRule /js/(*).js /servlet/my-file-servlet-and-access-logger.jsp?file=$1

Flags "-f" (is file) and "-d" (is directory) can be optionally supported.

Original issue reported on code.google.com by avl...@gmail.com on 5 Sep 2009 at 6:04

@GoogleCodeExporter
Copy link
Author

Issue 50 has been merged into this issue.

Original comment by avl...@gmail.com on 4 Jan 2010 at 6:39

@GoogleCodeExporter
Copy link
Author

Original comment by tuc...@gmail.com on 27 Jul 2010 at 9:02

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

This has now been added.  

For details, see:
http://code.google.com/p/urlrewritefilter/source/detail?r=287

I added unit tests and did some initial real testing with tomcat.  If someone 
could test this with a real-world scenario that would be great.

Original comment by tuc...@gmail.com on 28 Jul 2010 at 11:05

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Thanks Paul. I'll test it today.

Original comment by avl...@gmail.com on 29 Jul 2010 at 2:52

@GoogleCodeExporter
Copy link
Author

Is this available in 4.0?

Original comment by lmaj...@gmail.com on 26 Mar 2011 at 6:49

@jayenashar
Copy link

hi @paultuckey i don't see request-filename in the docs at http://cdn.rawgit.com/paultuckey/urlrewritefilter/master/src/doc/manual/4.0/index.html#condition . am i looking in the right place?

@paultuckey
Copy link
Owner

Looks like I never documented that for some reason. You can see the test cases here if it helps:

public void testFilename() throws InvocationTargetException, IOException, ServletException {

@jayenashar
Copy link

i think i'm ok for now. got things working as i want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants