问题
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