【发布时间】:2013-05-11 15:06:21
【问题描述】:
我有一个网址与 PHP 文件对应的网站:
www.mysite.com/cat.php?id=stuff
这些 PHP 文件不存在了,我该如何做一个 301 重定向(出于 SEO 原因)到新 URL:
www.mysite.com/stuff
我试过了
rewrite ^/cat\.php\?id=stuff http://www.mysite.com/stuff? permanent;
但它不起作用,我得到一个“没有指定输入文件”。
感谢您的帮助!
编辑:
更多关于我的配置(网站由 Wordpress 提供支持):
index index.php;
root /var/www/mydirectory;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
【问题讨论】: