I have created a virtualhost for one of my localhost websites:
<VirtualHost *:80>
ServerName mysite
DocumentRoot /var/www/html/mysite/public
<Directory /var/www/html/mysite/public>
Options Indexes FollowSymLinks
AllowOverride All
allow from all
</Directory>
</VirtualHost>
Now, I can't access other local websites anymore. for example when I go to localhost/anotherwwebite
I get redirected to mysite.
To get it work please follow these steps:
Enable Virtual host configuration file from httpd.conf 1
un comment (remove #
from start) below entry
#Include conf/extra/httpd-vhosts.conf`
Configure httpd-vhost.conf 2
Here you have to write two configurations set one for localhost and one for virtual host.
put following
<VirtualHost *:80> ServerAdmin localhost.admin DocumentRoot "C:\wamp\www" >> For UBUNTU /opt/lampp/htdocs/ ServerName localhost </VirtualHost>
(prior to virtual host)
<VirtualHost *:80> ServerAdmin pimcore.test DocumentRoot "C:\wamp\www\pimcore-latest" ServerName pimcore.test ErrorLog "logs/pimcore.test.log" CustomLog "logs/pimcore.test.log" common </VirtualHost>
and following entries in system hosts 3
127.0.0.1 localhost
127.0.0.1 pimcore.test
of course these will vary depends of Your virtual server names.
1 : C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf OR /opt/lampp/etc/httpd.conf
2 : C:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf OR /opt/lampp/etc/extra/httpd-vhosts.conf
3 : C:\WINDOWS\system32\drivers\etc\hosts: OR /etc/hosts
Regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With