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
why does remote wp-admin redirect to localhost?
提问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 问题。我找到了这个:
回答by gabrielbuzzi
You need to change it in wp_options table in database, and after it, regen all perma links :)
您需要在数据库的 wp_options 表中更改它,然后重新生成所有永久链接:)
回答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,此视频肯定会有所帮助
回答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\extra
directory and find httpd-vhosts.conf
file. 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\etc
directory and find hosts
file 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.php
file 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:在数据库中进行更改:
- change domain and path in
wp_blogs
table. - change
siteurl
andhome
inwp_options
table.
- 更改
wp_blogs
表中的域和路径。 - 更改
siteurl
并home
在wp_options
表中。
Note:In multisite WordPress creates the version of the table for wp_options
as wp_options
and wp_2_options
etc. You need to change as per your requirement.
注:在多点的WordPress创建的表的版本,wp_options
如wp_options
和wp_2_options
等您需要更改按照您的要求。