【发布时间】:2018-02-17 20:17:37
【问题描述】:
我正在尝试设置一些重写,以便 (1) .com/images/* 会自然加载 (2) .com/* 将被重写为 .com/loader.php?control=* 然而,下面的代码完美运行,除了它将执行 .com/config.php 而不是将其重写为 .com/loader.php?control=config.php
如何防止我的重写被覆盖?我只希望在 loader.php 或图像文件夹中执行 .php 文件。 (已经尝试了几个小时)
server {
listen 80;
root /mnt/web/test_com/public_html;
server_name test.com;
index index.html index.php index.htm;
location ~ .php(.*)$ {
fastcgi_pass unix:/tmp/php-70-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
fastcgi_param PATH_INFO $2;
include fcgi.conf;
}
location / {
rewrite ^/(.*)$ /loader.php?control=$1 last;
}
location /images/ {
}
}
谢谢!
【问题讨论】:
标签: nginx url-rewriting