1.先找到apache的設定檔httpd.conf 找出如下程式碼:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
把# Include conf/extra/httpd-vhosts.conf 去掉#號,如下:
Include conf/extra/httpd-vhosts.conf
保存。
2.打開Apache 的conf 目錄下的 extra 文件夾下的 httpd-vhosts.conf 文件,用記事本打開,在末尾加入以下代碼:
<span> 1</span> <VirtualHost *:80> <span> 2</span> ServerName www.mydemo.<span>com </span><span> 3</span> DocumentRoot "D:/mydemo" <span> 4</span> <Directory "D:/mydemo"> <span> 5</span><span>Options FollowSymLinks IncludesNOEXEC Indexes </span><span> 6</span> DirectoryIndex index.html index.htm <span>default</span>.htm index.php <span>default</span>.php index.cgi <span>default</span>.cgi index.pl <span>default</span>.pl index.<span>shtml </span><span> 7</span><span>AllowOverride Options FileInfo </span><span> 8</span> Order Deny,<span>Allow </span><span> 9</span><span>Allow from all </span><span>10</span> </Directory> <span>11</span> </VirtualHost>
3.再到C:->Windows-> System32->drivers->etc目錄,開啟hosts檔。
在最後加上以下程式碼:
1 127.0.0.1 www.mydemo.com
然後再建立D:mydemo目錄
再重新啟動一下
再重新啟動並重新啟動一下
然後再建立D:mydemo目錄
再重新啟動並重新啟動一下🎜🎜然後再建立D:mydemo目錄🎜再重新啟動並重新啟動一個apache。 🎜在瀏覽器輸入www.mydemo.com看看🎜 🎜 以上就介紹了php 在windows下配置虛擬目錄的方法,包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。 🎜 🎜 🎜