WordPress中类似URL的重定向问题

时间:2019-03-27 17:22:09

标签: wordpress nginx

我在Wordpress中有一个关于重定向的奇怪问题。 有两个页面具有相似的永久链接:

http://www.example.com/finance

http://www.example.com/finance-and-accounting

/finance-and-accounting地址上输入后,Wordpress重定向到/finance页面。

例如,当我将/finance-and-accounting更改为/123finance-and-accounting时,它可以正常工作,但是我需要当前地址。我坚信将当前地址更改为有效地址,并将重定向从/finance-and-accounting添加到新地址将是一个很好的解决方案,但是...

Wordpress根文件夹没有.htacces文件,但是包含nginx.conf文件,因此我猜它在nginx服务器上。重要-此nginx.conf文件为空。

我尝试将以下代码添加到nginx.conf:

location /finance-and-accounting {
  rewrite ^(.*)$ http://www.example.com/new-address redirect;
}

location http://www.example.com/finance-and-accounting {
  rewrite ^(.*)$ http://www.example.com/new-address redirect;
}

remove_action('template_redirect', 'redirect_canonical');

functions.php

但这是行不通的。它仍然重定向到/finance页。

0 个答案:

没有答案