简体   繁体   English

如何在WordPress网站上删除302重定向?

[英]How can I remove a 302 redirect on a WordPress site?

I have a WordPress site that is on a windows(plesk) server. 我有一个Windows(plesk)服务器上的WordPress网站。 There is no web.config file and from all the reading and speaking to others it seems that a 302 redirect is coming from the web-config.php file. 没有web.config文件,从与所有人的阅读和交谈中,似乎302重定向来自web-config.php文件。 Does anyone know what specifically I am looking for to remove? 有人知道我要删除的内容吗?

Specifically, the site is redirecting from http://www.davybrown.com to http://www.davybrown.com/ there is a bit of code that looks like this: 具体来说,该网站是从http://www.davybrown.com重定向到http://www.davybrown.com/,有一些代码看起来像这样:

/** WordPress absolute path to the Wordpress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

Am I stupid to assume that it's just a case of removing the . 我是否愚蠢地认为这只是删除的一种情况。 '/' and that will be that sorted? '/',那将是那种?

Thanks 谢谢

WordPress is redirecting it to the Canonical URL. WordPress将其重定向到规范URL。 If you don't want that, add this to your functions.php 如果您不想要,请将其添加到您的functions.php中

remove_action( 'template_redirect', 'redirect_canonical' );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM