url rewriting - How to change the URL from "localhost" to something else, on a local system using wampserver? -


on windows machine, there's system running on local wampserver, while application running on localhost, url says otherwise.

while expect url based on directory structure:

http://localhost/pro/include/db_report.php 

the developer has managed this:

http://ap-mispro/pro/include/db_report.php 

so instead of localhost, url says ap-mispro.

and both urls work fine.

how second url made? tried checking out wampmanager.ini , wampmanager.tpl maybe didn't know for?

windows + wamp solution

step 1
go c:\wamp\bin\apache\apache2.2.17\conf\
open httpd.conf file , change
#include conf/extra/httpd-vhosts.conf
to
include conf/extra/httpd-vhosts.conf
i.e. uncomment line can includes virtual hosts file.

step 2
go c:\wamp\bin\apache\apache2.2.17\conf\extra
and open httpd-vhosts.conf file , add following code

<virtualhost mywebsite.local>     documentroot "c:/wamp/www/mywebsite/"     servername mywebsite.local     serveralias mywebsite.local     <directory "c:/wamp/www/mywebsite/">         order allow,deny         allow     </directory> </virtualhost> 

change mywebsite.local , c:/wamp/www/mywebsite/ per requirements.

step 3
open hosts file in c:/windows/system32/drivers/etc/ , add following line ( don't delete )

127.0.0.1 mywebsite.local 

change mywebsite.local per name requirements

step 4
restart server. that's it


windows + xampp solution

same steps of wamp change paths according xampp corresponds path in wamp


Comments