Welcome to WebmasterWorld Guest from 54.158.36.59

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

RewriteCond to allow No Case

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

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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)

Thanks

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



keyplyr,

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.

Jim

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



D.C.

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.

Jim

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

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Thanks Jim, mod_speling works great!

<added>
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
</added>

 

Featured Threads

Hot Threads This Week

Hot Threads This Month