【发布时间】:2015-11-24 09:55:21
【问题描述】:
我已将我的网站移至 nginx,但可以正确获取 .htaccess 规则
下面是我的代码
server {
listen 80;
server_name mysite.com;
root /usr/share/nginx/mysite;
index index.php index.html index.htm;
location / {
rewrite ^/(.*)$ /members.php?id=$1 last;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
我想显示用户网址
mysite.com/jonny
而不是
mysite.com/memner.php?id=jonny
当我使用时
rewrite ^/(.*)$ /members.php?id=$1 last;
网站无法加载,请帮忙。
【问题讨论】:
-
如果 (!-e $request_filename) { rewrite /(.*) /members.php?id=$1 last ; }