Home 數位生活 Windows技巧 如何將localhost加...

如何將localhost加上子網域?

52
0

首先修改 HOSTS
Ex:
127.0.0.1 sub.localhost
127.0.0.1 sub1.localhost
127.0.0.1 sub2.localhost
127.0.0.1 images.localhost
127.0.0.1 www.mysiteonmycomp.com

接著修改 httpd.conf
Ex:


<VirtualHost *:80>
ServerName sub.localhost
DocumentRoot "C:/public_html/sub"
DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>

<VirtualHost *:80>
ServerName images.localhost
DocumentRoot "C:/public_html/images"
DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>

<VirtualHost *:80>
ServerName site.com
DocumentRoot "C:/public_html/site"
DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>
-傑克老師網路創業顧問站內所有文章歡迎轉貼,但請註明出處及網址-
如何將localhost加上子網域?
喜歡這篇文章嗎?

發表迴響