Tuesday, January 23, 2007

Rewrite: Captialize first letter

A useful mod_rewrite routine which capitalizes the first letter of the request and does some other clever stuff, thanks to Peter on http://forum.modrewrite.com for the advice.

RewriteEngine On
RewriteMap uppercase int:toupper
RewriteMap lowercase int:tolower
RewriteRule ^misc\.php$ - [L]
RewriteCond %{REQUEST_URI} !^.*/[A-Z][^A-Z]+\.php$
RewriteRule ^/misc/(.)(.+)\.php$ /misc.php?do=page&template=${uppercase:$1}${lowercase:$2} [NC,R=301,L]

1 comment:

Anonymous said...

The phone number in question is from the Technical Faults department from Talk Talk