more than one 'www' folder with wamp
Actually I have one website in c:/wamp/www path.
But now I want to manage a bunch of websites, I can create the filesystem hierarchy in www with a folder for each website. But the problem is 'document_root' variable is always referring to c:/wamp/www
SCRIPT_FILENAME : c:/wamp/www/website1/index.php
DOCUMENT_ROOT : c:/wamp/www
while I'd like : c:/wamp/www/website1
Can I create a folder in wamp folder and refer to it when typing its URI in my browser ?
e.g.
http://localhost/ -> c:/wamp/www/index.html
http://website1/ -> c:/wamp/www/website1/i开发者_开发问答ndex.php
thks
You need to use multiple VirtualHost
s (one for each host name) and use a distinct document root in each of them.
More details are available here: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
I usually create multiple virtual hosts for my projects: add the following lines to C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf
Listen 9191
NameVirtualHost *:9191
<VirtualHost *:9191>
ServerName web1.local
DocumentRoot "D:\VanCK\Projects\Web1\trunk\public_html"
<Directory "D:\VanCK\Projects\Web1\trunk\public_html">
AllowOverride All
Order Allow,Deny
Allow From all
</Directory>
</VirtualHost>
Listen 9292
NameVirtualHost *:9292
<VirtualHost *:9292>
ServerName web2.local
DocumentRoot "D:\VanCK\Projects\Web2\trunk\public_html"
<Directory "D:\VanCK\Projects\Web2\trunk\public_html">
AllowOverride All
Order Allow,Deny
Allow From all
</Directory>
</VirtualHost>
add the following lines to C:\Windows\System32\drivers\etc\hosts
127.0.0.1 web1.local
127.0.0.1 web2.local
enable rewrite_module (click on WAMP icon > Apache > Apache modules > check rewrite_module) restart all services
=> http://web1.local:9191/ and http://web2.local:9292/
you need to add
Options Indexes FollowSymLinks
after :
AllowOverride All
Order Allow,Deny
Allow From all
精彩评论