• Joomla!SEF模块的nginx rewrite 配置

    Posted on 二月 23rd, 2009 inetdemon 1 comment

    #如果要设置nginx下joomla下的seo静态化插件以下这段设置是必须的

    if ( !-e $request_filename ) {
    rewrite (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ /index.php last;
    break;
    }
    #下面这段是joomla 1.5防止攻击的url rewrite转译

    if ( $args ~ “mosConfig_[a-zA-Z_]{1,21}(=|\%3d)” ) {
    set $args “”;
    rewrite ^.*$ http://$host/index.php last;
    return 403;
    }
    if ( $args ~ “base64_encode.*\(.*\)” ) {
    set $args “”;
    rewrite ^.*$ http://$host/index.php last;
    return 403;
    }
    if ( $args ~ “(\<|%3C).*script.*(\>|%3E)” ) {
    set $args “”;
    rewrite ^.*$ http://$host/index.php last;
    return 403;
    }
    if ( $args ~ “GLOBALS(=|\[|\%[0-9A-Z]{0,2})” ) {
    set $args “”;
    rewrite ^.*$ http://$host/index.php last;
    return 403;
    }
    if ( $args ~ “_REQUEST(=|\[|\%[0-9A-Z]{0,2})” ) {
    set $args “”;
    rewrite ^.*$ http://$host/index.php last;
    return 403;
    }
    然后将上面的文件命名为vi joomla-sef.conf,然后include到nginx的configure文件中就可以了。

    nginx重定向的相关用法可以参照nginx rewrite规则设定详细介绍(中文)

     

    One response to “Joomla!SEF模块的nginx rewrite 配置”

    1. 蓝色夏威夷

      谢谢,可用的啊。帮别人找的,Joomla!不熟的。

    Leave a reply