To access the localhost websites from another computers in a same network, need to follow these steps :
- Set up a virtual host
- Configure your hosts file
You first need to set up a virtual host in your apache
httpd-vhosts.conf file. On XAMP, you can find this file here: C:\xampp\apache\conf\extra\httpd-vhosts.conf This step prepares the Web server on your computer for handling symfony.local
requests. You need to provide the name of the Virtual Host as well as
the root/main folder of your website. To do this, add the following line
at the end of that file. You need to change the DocumentRoot to wherever your main folder is. Here I have taken /Applications/MAMP/htdocs/Symfony/ as the root of my website.<VirtualHost *:80>
DocumentRoot "/Applications/MAMP/htdocs/Symfony/"
ServerName symfony.local
</VirtualHost>
Configure your hosts file:
For the browser understand what symfony.local really means,
you need to edit the hosts file on your computer.
(if you're using WINDOWS 7, this file is in
\Windows\system32\drivers\etc\hosts).
## # Host Database # localhost is used to configure the loopback interface ## #... 127.0.0.1 symfony.localThats it. Now the configuration is completed.Note: you should replace the above ip address with your system ip address.Finally, you have to change the base secure and unsecure urls indatabase atcore_config_data table.Then your url will be change from http:localhost/projecttohttp://127.0.0.1/project.
