MAC Nginx + PHP 使用ThinkPHP怎么去掉index.php

浏览:2375 发布日期:2015/09/11 分类:求助交流 关键字: MAC Nginx 去掉index.php
添加了.htaccess还是要加index.php否则出现:File not found.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

求解

nginx default.conf配置文件
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}

location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param script_FILENAME $document_root$real_script_name;
fastcgi_param script_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>