homepage Welcome to WebmasterWorld Guest from 107.20.131.154
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Case Insensitive Rewrite Rule
I know I need to add an "i" but where?
itledi




msg:3536596
 8:16 pm on Dec 28, 2007 (gmt 0)

I'm trying to modify a rewrite rule in my .htaccess file to be case insensitive.

RewriteRule ^([aeiouy]{1})/?$ ...

I know I need to add an "i" somwhere to make it to also accept uppercase letters, but where?

I guessed inside the set at the end, but it didn't seem to work.
RewriteRule ^([aeiouy/i]{1})/?$ ...

 

milanmk




msg:3536639
 9:18 pm on Dec 28, 2007 (gmt 0)

You need to set flag (NC) as third argument to the RewriteRule directive.

Apache module mod_rewrite [httpd.apache.org]

Milan

jdMorgan




msg:3536646
 9:30 pm on Dec 28, 2007 (gmt 0)

And the "{1}" is redundant, since {1} is the default quantifier for all pattern elements:

RewriteRule ^([aeiouy])/?$ new_path [NC]

Also, you won't need the parentheses unless you wish to back-reference the enclosed matched subpattern.

Jim

itledi




msg:3536656
 9:42 pm on Dec 28, 2007 (gmt 0)

Thank you.

The [NC] does the trick, and I also didn't realize that {1} is redundent, now now I'm able to trim up my code a bit.

I do back reference the subpattern.

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved