在nginx如何隐藏index.php?
Options -IndexesRewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
以上的是在本地apache上的,没问题,但是传到nginx上就不行了。请问apache是否和xginx的rewrite不同呢?
而且,即使加上index.php。也不正常。。。。
如下图:
本地的:
本地加上index.php
服务器上的:
server
{
listen 80;
server_name 网站域名;
index index.html index.htm index.php;
root/usr/local/web/pr/;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
if ($request_filename !~* /(js|skin|upload|style|ls|img|css|images|fckeditor|userfiles|crontab|robots\.txt|index\.php|system\.php)) {
rewrite ^/(.*)$ /index.php?$1 last;
}
if ($request_filename ~* /(system\.php)) {
rewrite ^/(.*)$ /system.php?$1 last;
}
if ($request_filename ~* /(system\.php)) {
rewrite ^/(.*)$ /webscan_360_cn.html?$1 last;
}
location ~ \.php {
set $real_script_name $fastcgi_script_name;
set $path_info "";
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;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
} 这么长的一段。。。。写在哪里的?
写在.htaccess文件上吗? vergil 发表于 2012-2-17 10:39 static/image/common/back.gif
这么长的一段。。。。写在哪里的?
写在.htaccess文件上吗?
nginx 没有 .htaccess
你可以在论坛搜索 nginx,或者用CI搜索引擎搜索。 那加上index。php也不正常是在怎么回事?
页:
[1]