コンピューターでローカルに Wordpress サイトを開発しています。Wordpress を 2 つインストールしています。1 つはC:\xampp\htdocs\wordpress内にあり、もう 1 つはC:\My_Sites\medicalproject\wordpressにあります。
XAMPP がインストールされており、 localhost/wordpressと入力して最初のインストールにアクセスします。2 つ目は、 medicalprojectという名前の仮想ホストを作成し、それにアクセスするには、ブラウザーを開いてmedicalprojectと入力するだけです。
テスト目的で別のホストを作成しようとするまで、すべてがうまくいっていました。機能していないことがわかったので、新しい仮想ホストを削除し、medicalprojectのみを残しました。しかし、問題は解決されていません。何が起こるかというと、ブラウザ (FF、IE、Chrome、Opera) がmedicalprojectを認識せず、代わりに Google 検索を実行します。Apache は正常に起動し、最初のインストールであるlocalhostとlocalhost/wordpressの両方にアクセスできます。
2 番目の仮想ホストを追加しようとしたときに、ローカル ホストのループバック IP (127.0.0.1 とサーバーの名前) を追加する必要があるホスト ファイルへのアクセスが Avira Free Antivirus によってブロックされたことに言及しました。その機能を無効にし、数回再起動して試しましたが、うまくいきませんでした。
以下は、私の httpd-vhosts.conf がどのように見えるかです。この正確な構成は以前に機能していたことに言及します。
## Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host.localhost
##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
##ServerName dummy-host.localhost
##ServerAlias www.dummy-host.localhost
##ErrorLog "logs/dummy-host.localhost-error.log"
##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host2.localhost
##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
##ServerName dummy-host2.localhost
##ServerAlias www.dummy-host2.localhost
##ErrorLog "logs/dummy-host2.localhost-error.log"
##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
Servername localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\My_Sites\medicalproject\wordpress"
ServerName medicalproject
ErrorLog "C:\My_Sites\medicalproject\medicalproject.error.log"
CustomLog "C:\My_Sites\medicalproject\medicalproject.access.log" combined
<Directory "C:\My_Sites\medicalproject\wordpress">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>