【发布时间】:2015-07-17 20:15:21
【问题描述】:
我正在尝试使用 nginx 将old.php(包括任何参数)重定向到主页。它应该是301 redirect
我尝试了以下重写(在服务器块中)但它不起作用
rewrite ^old.php(.*)$ https://www.example.com permanent;
我也有一个 php 位置块
location ~* \.php$ {
root /var/www/example.com/public_html/www;
try_files $uri =404;
fastcgi_pass unix:/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
【问题讨论】:
-
您在寻找 [QSA,R=301,L] 吗?