
When setting up new local sites for development, skip the hassle with this game-changing setup that uses a single vhost with a wildcard subdomain so you never have to mess with vhosts ever again.
- Don’t hassle with setting up a vhost every time
- Don’t waste time adding more rows to your hosts file
- Don’t mess with developing a site in a subdirectory where absolute links starting with “/” take you back to your localhost dashboard.
Instead, use this dynamic vhost configuration that takes all subfolders of your workspace and makes them accessible as a subdomain.
httpd-vhosts.conf:
# Virtual Hosts # UseCanonicalName Off <VirtualHost *:80> ServerName localhost DocumentRoot c:/wamp64/www <Directory "c:/wamp64/www/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost> <VirtualHost *:80> ServerName localhost.tv ServerAlias *.localhost.tv VirtualDocumentRoot "c:/Workspace/%1" <Directory "c:/Workspace/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost> #
After that is setup, you just git clone in your workspace folder, you can instantly access that site at http://repo-name.localhost.tv
Localhost.tv is a website that has a wildcard DNS for all subdomains to point to 127.0.0.1 so everyone can use it to point to their own localhost.