Wordpress not working when using Apache virtual hosts

扶醉桌前 提交于 2019-12-12 01:31:32

问题


I currently use virtual hosts on my computer so that I can manage multiple sites on my computer.

Currently, I use c:/vhosts/php (default localhost) for regular PHP development, c:/vhosts/BTS for Wordpress, and c:/vhosts/cake for CakePHP development. (see below).

Now when I launch my WAMPP and go to http://BTS, it loads the index page but nothing else loads fine. When trying to click on the links, it links to http://localhost/xxxxx instead of http://BTS/xxxxx. What am I missing here? I don't want the server to access localhost since I'm using localhost for other projects. Please help.

<VirtualHost *:80>
DocumentRoot c:/vhosts/php
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot c:/vhosts/BTS
ServerName BTS
</VirtualHost>

<VirtualHost *:80>
DocumentRoot c:/vhosts/cake
ServerName cake
</VirtualHost>

回答1:


Go into your MySQL database (thru phpmyadmin or whatever) and look for the following fields

In the wp_options table, change

siteurl
home

To http://BTS instead of localhost.

This will update all your links in wordpress.




回答2:


You need to tell Wordpress what domain it is sitting on.

Login to your Admin CP, it's in settings somewhere



来源:https://stackoverflow.com/questions/1778266/wordpress-not-working-when-using-apache-virtual-hosts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!