I am using Laravel 5.4 .(Apache 2.4.8)
/etc/hosts:
127.0.0.1 project.local
/etc/apache2/sites-available/project.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/project/public
ServerName project.local
ServerAlias *.project.local
<Directory /var/www/html/project/public>
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
commands:
sudo nano /etc/hosts
sudo nano /etc/apache2/sites-available/project.conf
sudo a2ensite project.conf
sudo service apache2 reload
project.local ~> Works
somesubdomain.project.local or www.project.local ~> Not working .
Any help ? Thanks.
You still need to add an entry in your hosts file for every subdomain you want to hit:
/etc/hosts
127.0.0.1 project.local www.project.local somesubdomain.project.local
Please note that the hosts file does not support wildcard domains. For example:
127.0.0.1 *.project.local # WILL NOT WORK
There is another answer on stackoverflow here that suggests using DNSMASQ to achieve what you are trying to do. Otherwise you may want to consider setting up a DNS server. (See BIND or PowerDNS). Depending on how much network access you have, your router may be able to help out too.