On a Windows machine, there's a system running on the local wampserver, but while the application is running on localhost, the URL says otherwise.
While I would expect the URL to be like this based on the directory structure:
http://localhost/pro/include/db_report.php
The developer has managed to do this:
http://ap-mispro/pro/include/db_report.php
So instead of localhost
, the URL says ap-mispro
.
And both URLs work fine.
How is the second URL made? I tried checking out the wampmanager.ini
and wampmanager.tpl
but maybe I didn't know what to look for?
WINDOWS + WAMP solution
Step 1
Go to
C:\wamp\bin\apache\Apache2.2.17\conf\
open
httpd.conf
file and change#Include conf/extra/httpd-vhosts.conf
to
Include conf/extra/httpd-vhosts.conf
i.e. uncomment the line so that it can includes the virtual hosts file.
Step 2
Go to
C:\wamp\bin\apache\Apache2.2.17\conf\extra
and open
httpd-vhosts.conf
file and add the following codechange
myWebsite.local
andC:/wamp/www/myWebsite/
as per your requirements.Step 3
Open
hosts
file inC:/Windows/System32/drivers/etc/
and add the following line ( Don't delete anything )change
myWebsite.local
as per your name requirementsStep 4
restart your server. That's it
WINDOWS + XAMPP solution
Same steps as that of WAMP just change the paths according to XAMPP which corresponds to path in WAMP
After another hour or two I can actually answer my own question.
Someone on another forum mentioned that you need to keep a mention of plain ol' localhost in the httpd-vhost.conf file, so here's what I ended up with in there:
Exit WAMP, restart - good to go. Hope this helps someone else :)
for new version of Wamp
please refer http://complete-concrete-concise.com/web-tools/how-to-change-localhost-to-a-domain-name
this is best solution ever
Copy the
hosts
file and add127.0.0.1
and name which you want to show or run at browser link. For example:Then run
abc.com
as a local host in browser.They are probably using a virtual host (http://www.keanei.com/2011/07/14/creating-virtual-hosts-with-wamp/)
You can go into your Apache configuration file (httpd.conf) or your virtual host configuration file (recommended) and add something like:
And when you call up
http://ap-mispro/
you would see whatever is in C:/wamp/www/ap-mispro (assuming default directory structure). The ServerName and DocumentRoot do no have to have the same name at all. Other factors needed to make this work:http://ap-mispro
into your browser. This change to your hosts file will only apply to your computer - not that it sounds like you are trying from anyone else's.There are plenty more things to know about virtual hosts but this should get you started.