强制小写的.htaccesshtaccess

由网友(又酷又能打)分享简介:我试图做RewriteEngine叙述上RewriteMap指令LC INT:TOLOWER的RewriteCond%{REQUEST_URI} [A-Z](。*)重写规则$ {LC:$ 1} [R = 301,L]不过,我收到500内部错误。不知道什么是错的。错误:/home/public_html/.htac...

我试图做

  RewriteEngine叙述上
RewriteMap指令LC INT:TOLOWER
的RewriteCond%{REQUEST_URI} [A-Z]
(。*)重写规则$ {LC:$ 1} [R = 301,L]
 

不过,我收到500内部错误。不知道什么是错的。

错误:

  /home/public_html/.htaccess:RewriteMap指令此处不允许
[周一7月18日10点33分06秒2011] [警惕] [客户端* *。*。*] /home/public_html/.htaccess:RewriteMap指令这里不允许
 

解决方案 第3天 phtml绕过 htaccess绕过 大小写绕过

如果你使用PHP,你可以在你的index.php的开始把这个

  $ URL = $ _ SERVER ['REQUEST_URI'];
$模式='/([A-Z] +)/';

如果(preg_match($模式,$网址)){
    $ new_url =用strtolower($网址);

    头(HTTP / 1.1 301永久移动);
    头('位置:'$ new_url。);
    出口;
}

//你的code在这里
 

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

解决方案

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

阅读全文

相关推荐

最新文章