Create sub domains on apache localhost.
Today I will tell you how to create sub domains on your localhost system using apache. It’s very easy just need to follow few steps.
- Decide sub domains that you want to create. I choose sub domain for phpmyadmin for instance.
Open you host file that is located in “Windows/System32/drivers/etc/” and add following line in it.
Open your httpd.conf file located in apache conf folder if you are using wamp then it’s exact path will be “wamp\bin\apache\Apache2.2.17\conf” and find following lines in it.
# Virtual hosts
Uncomment second line by removing hash sign(#).
Open your httpd-vhosts.conf file located in extra folder of apache again if you are using wamp then it will be located in “wamp\bin\apache\Apache2.2.17\conf\extra\” file will look like following image.
Do following changes.
Write localhost in place of * like “NameVirtualHost localhost:80” and add following lines
<VirtualHost phpmyadmin.localhost:80> ServerAdmin email@example.com-PC.ingenidev DocumentRoot "E:/wamp/apps/phpmyadmin3.3.9/" ServerName phpmyadmin.localhost <Directory "E:/wamp/apps/phpmyadmin3.3.9/"> Options Indexes FollowSymLinks AllowOverride FileInfo Order allow,deny Allow from all </Directory> </VirtualHost>
phpmyadmin.localhost = SUBDOMAIN NAME
E:/wamp/apps/phpmyadmin3.3.9/ = complete path of the site for which you want to create sub domain.
- Finally, restart your apache server
- If setting doesn’t work then you might need to restart system as some times host file changes require to restart system.