Wamp 本地主机编辑将我发送到 WAMPSERVER 主页
Wamp localhost editing send me to WAMPSERVER Homepage
我想更改我网站的地址 http://localhost/tests/home.html
至 www.mywebsite.com.
我按照说明编辑了以下文件:
C:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
C:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf
C:\Windows\System32\drivers\etc\hosts
但是,我没有重定向到 home.html,而是重定向到 Wamp 服务器主页。
关于如何解决这个问题的任何想法?有关信息,这是我的 httpd-vhosts.conf
和 hosts
文件。
<VirtualHost *:80>
ServerName www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 www.mywebsite.com
::1 localhost
::1 tests
::1 www.mywebsite.com
另请注意,我的 www/tests
文件夹中有多个文件,但我想专门访问 home.html。
创建虚拟主机时还需要一个本地主机的 VH 定义
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
服务器名称应为 mywebsite.com
,如果您想使用 www.www.mywebsite.com
,则服务器名称应为 ServerAlias
<VirtualHost *:80>
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
托管文件更改
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 mywebsite.com
::1 localhost
::1 tests
::1 mywebsite.com
完成这些更改后,记得重置 dnscache
net stop dnscache
net start dnscache
然后重新启动 Apache 以获取这些更改
wampmanager -> Apache -> Restart Service
我想更改我网站的地址 http://localhost/tests/home.html 至 www.mywebsite.com.
我按照说明编辑了以下文件:
C:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
C:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf
C:\Windows\System32\drivers\etc\hosts
但是,我没有重定向到 home.html,而是重定向到 Wamp 服务器主页。
关于如何解决这个问题的任何想法?有关信息,这是我的 httpd-vhosts.conf
和 hosts
文件。
<VirtualHost *:80>
ServerName www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 www.mywebsite.com
::1 localhost
::1 tests
::1 www.mywebsite.com
另请注意,我的 www/tests
文件夹中有多个文件,但我想专门访问 home.html。
创建虚拟主机时还需要一个本地主机的 VH 定义
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
服务器名称应为 mywebsite.com
,如果您想使用 www.www.mywebsite.com
ServerAlias
<VirtualHost *:80>
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
托管文件更改
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 mywebsite.com
::1 localhost
::1 tests
::1 mywebsite.com
完成这些更改后,记得重置 dnscache
net stop dnscache
net start dnscache
然后重新启动 Apache 以获取这些更改
wampmanager -> Apache -> Restart Service