tp框架-遇到的二级域名,经常出现一些好意外的问题,重定向等问题。
路径都在前面加上了./ 不知道为什么
如图下
下面的是我的配置
- 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;
- }
- }
遇到上面问题,莫惊慌。
在入口(index.php)文件定义一下就可以了
define('_PHP_FILE_',$_SERVER['SCRIPT_NAME']);