ThinkPHP添加新的模块,以及在Nginx下配置伪静态
在本地测试好好的,传到服务器就是403拒绝。经过各种测试,问题是分2步解决的:
1、注册新的模块,在Application\Common\Conf\config.php下,添加以下配置:
\’DEFAULT_MODULE\’ => \’Home\’,
\’MODULE_ALLOW_LIST\’ => array(\’Home\’,\’Free301\’),
2、配置Nginx伪静态规则(Apache的.htaccess妥妥无效)
添加以下代码:
location / {
root /var/www;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
——————
完美解决