How to change mod_rewrite to avoid {REQUEST_FILENAME} in order to get around 255 character URL limit?
- by Jeremy Reimer
According to this answer: max length of url 257 characters for mod_rewrite? there is a maximum 255 character hard limit based on the file system for using mod_rewrite.
According to the accepted answer, there are two solutions:
Change the URL format of your application to a max of 255 characters between each slash.
Move the Rewrite rules into the apache virtual host config and remove the REQUEST_FILENAME.
I cannot use the first method, so I am trying to figure out the second.
I have put the Rewrite rules into the Apache virtual host config as requested. However I cannot figure out how to remove the REQUEST_FILENAME and still have my web application framework (Dragonfly) still work.
Here is the portion of the rewrite rules that I moved from .htaccess into the virtual host config file of Apache:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f [OR]
# if don't want Dragonfly to process html files comment
# out the line below (you may need to remove the [OR] above too).
RewriteCond %{REQUEST_FILENAME} \.(html|nl)$
# Main URL rewriting.
RewriteRule (.*) index.cgi?$1 [L,QSA]
I've tried removing {REQUEST_FILENAME} and it just breaks the framework in various ways. How do I rewrite this without using {REQUEST_FILENAME}?