我的WordPress网站有问题。它在本地主机上运行良好,但当我试图向它添加一个虚拟主机时,我无法访问管理面板。我使用的是xampp。
我曾试图通过在搜索栏中输入http://localhost/commerce/wp-admin
和me.commerce.loc/wp-admin
来访问它,但都不起作用。两者都返回Oops! That page can’t be found.
。
下面是我在httpd-vhosts.conf
文件中编写的代码:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/commerce"
ServerName webmaster.loc
</VirtualHost>
这是我的.htaccess
文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我在hosts
文件中的代码:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 me.commerce.loc
发布于 2019-07-23 19:17:47
您还可以在wp-config.php
中覆盖siteurl
和homeurl
。
define('WP_HOME','http://me.commerce.loc');
define('WP_SITEURL','http://me.commerce.loc');
有关https://help.dreamhost.com/hc/en-us/articles/214580498-How-do-I-change-the-WordPress-Site-URL-的更多详细信息,请参阅此帖子
发布于 2019-07-23 19:07:06
我做了一些研究,结果发现我必须更改wp_options
表中的siteurl
和home
字段。在将它们设置为我的v-host地址后,它可以完美地工作。
https://stackoverflow.com/questions/57162352
复制相似问题