Reputation: 21
I tried to do
RewriteEngine On
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
But, I receive a 500 internal error. Not sure what's wrong.
Error:
/home/public_html/.htaccess: RewriteMap not allowed here
[Mon Jul 18 10:33:06 2011] [alert] [client *.*.*.*] /home/public_html/.htaccess: RewriteMap not allowed here
Upvotes: 2
Views: 1867
Reputation: 165228
RewriteMap
CANNOT be declared in .htaccess file -- only in server config / virtual hosting context: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritemap
If you cannot edit Apache's config files, then you are out of luck -- you have to implement such redirect using some script -- PHP, for example.
Upvotes: 3
Reputation: 1971
If your using PHP you could put this in the beginning of your index.php
$url = $_SERVER['REQUEST_URI'];
$pattern = '/([A-Z]+)/';
if(preg_match($pattern, $url)) {
$new_url = strtolower($url);
Header( 'HTTP/1.1 301 Moved Permanently' );
Header( 'Location: ' . $new_url );
exit;
}
// your code here
Upvotes: 3