Support remap to lowecase in httpd.conf


#1

Shared hosting users can’t edit httpd.conf, but there is a little remap line that if added could benefit many:

RewriteEngine on
RewriteBase /
RewriteMap lowercase int:tolower

With this one could use in any htaccess a line such as
RewriteRule ^/?(.*)$ /${lowercase:$1} [R=301,L]
to rewrite an URL in lowecase for many manipulation purposes.

Source:


#2

If your request isn’t heard, there are several ways to do it.

For static files, you can catch lowercase (or uppercase, whatever) file request with 404 error page script and serve the desired page, and also create a symlink so that all subsequent requests are served without going through any script.

If you don’t like to send 404 header, you can redirect requests for case-mismatched/non-existent files with a RewriteRule and handle with it (to get 200 response header).
It’s possible to handle this with nph script, as well, but I don’t think it’s necessary and symlink is lighter and easier.

For script pages, you can use one general script that converts case and include/import desired script without much penalty.


#3

With regard to RewriteMap: that’s a good idea! I’ll see about getting the following lines into our standard Apache configuration:

RewriteMap tolower int:tolower RewriteMap toupper int:toupper RewriteMap escape int:escape RewriteMap unescape int:unescape


#4

I tried to use the ‘escape’ map in my .htaccess, but with no success.

Has this been added in the 9 months since this posting?


#5

When did you try? I added those four RewriteMap rules to our standard httpd.conf a few days after I made that post.