is it possible to create subdomains on my localhost? like sub.localhost
and would like to know how subdomains work.
You need to set your /etc/hosts or C:\Windows\system32\drivers\etc\hosts (as administrator) to reflect the "subdomain". So add 127.0. 0.1 dev. localhost to either file (depending on your platform).
Because subdomains are regarded as separate websites by Google, they also need to be hosted on separate hosting plans. This means that you will need to pay a separate hosting fee for each subdomain.
Create a virtual host as such:
<VirtualHost *:80> ServerName sub.localhost DocumentRoot "C:/public_html/sub" </VirtualHost>
And in your hosts file add this line:
127.0.0.0 sub.localhost
Here is a useful tutorial you might find helpful.
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