homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

RewriteCond to allow No Case

 9:49 am on Oct 26, 2003 (gmt 0)

My server is Apache/BSD

I have several files that use upper-case letters, e.g. addURL.html, FAQ.html, etc.

Ocassionally, I see errors because the request was for lower-case. e.g. addurl.html, faq.html.

Is there a way to allow or match to no-case? Something like this:

RewriteCond %{HTTP_HOST}!^$ [NC]
(obviously, I'm guessing here - LOL)




 1:50 pm on Oct 26, 2003 (gmt 0)


Good guess.... [httpd.apache.org...]

But since the pattern will match *anything* that is not blank, you don't need the [NC] flag in the example you posted.



 2:00 pm on Oct 26, 2003 (gmt 0)


OK, I think I figured out your question...

Mod_rewrite can't easily be set up to do case conversion. You could do something like:

RewriteCond %{REQUEST_URI} !^widget\.html$
RewriteRule ^widget\.html$ http://example.com/widget.html [NC,R=301,L]

This would rewrite any request for any capitalization variant of "WidGet.html" to "widget.html" unless it was already correct (all lowercase as shown here). But you'd essentially have to handle every case individually.

You should investigate using mod_speling [httpd.apache.org] instead; It will identify "close matches" for requested pages, including spelling and capitalization errors.



 11:55 pm on Oct 26, 2003 (gmt 0)

Thanks Jim, mod_speling works great!

Anyone have negative experience using this: server-lag or file confusion? Should the "CheckSpelling On" be placed at the bottom of the .htaccess file or does it matter? Thanks

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved