Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 972
user961627 Avatar asked Jul 15 '13 10:07

user961627


People also ask

How do I change my localhost domain to mysql?

Replace localhost with the value from server on domain image. Replace root with username value from domain image. Where you see empty single quotes near password in the code, use the password from the domain image. Replace calendarevent with cl41-...

How do I change my localhost domain to laravel?

Its quite simple to set up. The to: in the mapping points to the location of the public folder in your Laravel installation on Homestead. Then you need to edit the hosts file on your computer. It's located at /etc/hosts on Mac or Linux alternatively you can find it at C:\Windows\System32\drivers\etc\hosts on Windows.


2 Answers

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 code

<VirtualHost myWebsite.local>     DocumentRoot "C:/wamp/www/myWebsite/"     ServerName myWebsite.local     ServerAlias myWebsite.local     <Directory "C:/wamp/www/myWebsite/">         Order allow,deny         Allow from all     </Directory> </VirtualHost> 

change myWebsite.local and C:/wamp/www/myWebsite/ as per your requirements.

Step 3
Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything )

127.0.0.1 myWebsite.local 

change myWebsite.local as per your name requirements

Step 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

like image 173
Abhishek Goel Avatar answered Oct 08 '22 11:10

Abhishek Goel


Copy the hosts file and add 127.0.0.1 and name which you want to show or run at the browser link. For example:

127.0.0.1   abc 

Then run abc/ as a local host in the browser.

1

like image 29
ADEEL AHMAD Avatar answered Oct 08 '22 12:10

ADEEL AHMAD