wordpress 为什么远程 wp-admin 重定向到本地主机?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15292790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:11:14  来源:igfitidea点击:

why does remote wp-admin redirect to localhost?

wordpress

提问by babbaggeii

I created a wordpress site on my local computer, then uploaded it to a remote server. The CSS wasn't working and I realised that it was looking at localhost to try to find it, when it should have been looking at the remote server. So I went to www.remoteserver.co.uk/wp-admin and it redirected me to localhost/wp-admin.

我在本地计算机上创建了一个 wordpress 站点,然后将其上传到远程服务器。CSS 不起作用,我意识到它正在查看 localhost 以尝试找到它,而它应该查看远程服务器。所以我去了 www.remoteserver.co.uk/wp-admin 并将我重定向到 localhost/wp-admin。

Does anyone know what I'm doing wrong?

有谁知道我做错了什么?

回答by babbaggeii

I've solved it now - it was a site url problem. I found this:

我现在已经解决了 - 这是一个站点 url 问题。我找到了这个:

http://codex.wordpress.org/Changing_The_Site_URL

http://codex.wordpress.org/Changing_The_Site_URL

回答by gabrielbuzzi

You need to change it in wp_options table in database, and after it, regen all perma links :)

您需要在数据库的 wp_options 表中更改它,然后重新生成所有永久链接:)

回答by kokabi

Go to phpmyadmin and follow the picture bellow: enter image description here

转到 phpmyadmin 并按照下面的图片操作: 在此处输入图片说明

回答by kokabi

There are two areas in the WP_OPTIONS that you need to change. One is one the fisrt page and the other one is on the 2nd page.

WP_OPTIONS 中有两个区域需要更改。一个是第一页,另一个在第二页。

This video will definitely help if you have access to phpMyAdmin

如果您可以访问 phpMyAdmin,此视频肯定会有所帮助

http://educhalk.org/blog/?p=21

http://educhalk.org/blog/?p=21

回答by Gufran Hasan

If your multisite site is set up on localhost then you need to do the following steps:

如果您的多站点站点是在 localhost 上设置的,那么您需要执行以下步骤:

for windows machine:

对于 Windows 机器:

step1:create the virtual host

step1:创建虚拟主机

Go to xampp\apache\conf\extradirectory and find httpd-vhosts.conffile. Open it and put this code:

转到xampp\apache\conf\extra目录并找到httpd-vhosts.conf文件。打开它并输入以下代码:

For the first domain:

对于第一个域:

<VirtualHost *:80>
    ServerName multisite-one.com
    DocumentRoot "C:\xampp\htdocs\multisite
    <Directory  "C:\xampp\htdocs\multisite">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

For the second domain:

对于第二个域:

<VirtualHost *:80>
    ServerName multisite-two.com
    DocumentRoot "C:\xampp\htdocs\multisite
    <Directory  "C:\xampp\htdocs\multisite">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Go to the C:\Windows\System32\drivers\etcdirectory and find hostsfile and open it as administrator. put these lines in it and restart the server.

转到C:\Windows\System32\drivers\etc目录并找到hosts文件并将其打开为administrator. 将这些行放入其中并重新启动服务器。

#wordpress multisite set up
127.0.0.1   multisite-one.com
127.0.0.1   www.multisite-one.com

127.0.0.1   multisite-two.com
127.0.0.1   www.multisite-two.com

step2:Make changes in wp-config.phpfile as:

step2:wp-config.php文件更改为:

define('WP_DEBUG', false);
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'multisite-one.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

step3:Make changes in the database as:

步骤3:在数据库中进行更改:

  1. change domain and path in wp_blogstable.
  2. change siteurland homein wp_optionstable.
  1. 更改wp_blogs表中的域和路径。
  2. 更改siteurlhomewp_options表中。

Note:In multisite WordPress creates the version of the table for wp_optionsas wp_optionsand wp_2_optionsetc. You need to change as per your requirement.

注:在多点的WordPress创建的表的版本,wp_optionswp_optionswp_2_options等您需要更改按照您的要求。