Want more features on Pastebin? Sign Up, it's FREE!
Guest

Force lowercase .htaccess

By: a guest on Apr 10th, 2012  |  syntax: None  |  size: 0.52 KB  |  views: 51  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. RewriteEngine On
  2. RewriteMap  lc int:tolower
  3. RewriteCond %{REQUEST_URI} [A-Z]
  4. RewriteRule (.*) ${lc:$1} [R=301,L]
  5.        
  6. /home/public_html/.htaccess: RewriteMap not allowed here
  7. [Mon Jul 18 10:33:06 2011] [alert] [client *.*.*.*] /home/public_html/.htaccess: RewriteMap not allowed here
  8.        
  9. $url = $_SERVER['REQUEST_URI'];
  10. $pattern = '/([A-Z]+)/';
  11.  
  12. if(preg_match($pattern, $url)) {
  13.     $new_url = strtolower($url);
  14.  
  15.     Header( 'HTTP/1.1 301 Moved Permanently' );
  16.     Header( 'Location: ' . $new_url );
  17.     exit;
  18. }
  19.  
  20. // your code here
clone this paste RAW Paste Data