3

Maybe a pretty basic question but I want to know that how I can change my localhost URL for larvel from localhost:8000 to something.com. I searched but I found solutions for xampp and wamp which does not apply to laravel I think.

1

2 Answers 2

3

Its quite simple to set up.

You need to ensure that you're mapping the domain you want to use in your homestead.yaml file so it would like this for example:

sites:
    - map: something.com
      to: /home/vagrant/Code/Laravel/public

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.

You will need administrator rights to change this.

Now change this:

192.168.10.10  something.com

You can change the something.com to the domains you want to use.

More info at Homestead documentation

Sign up to request clarification or add additional context in comments.

2 Comments

I am not using homestead
The method is largely the same. You need to make sure XAMPP, WAMP etc is listening for traffic to that domain and then point your local hosts file at your server which is usually 127.0.0.1 So for example using XAMPP you would add an addition to your httpd-vhosts.config file mapping the domain to the public Laravel folder. I believe this is found in C:/xampp/apache/config/extra/ I'm not sure what server you're using or if you're on Mac, Linux or Windows. FWIW using Homestead will make your life easier. I kept running into frustrating issues before making the change.
1

VlcdeMacBook-Pro:blog vlc$ php artisan serve --port=9200 Laravel development server started: http://127.0.0.1:9200

just like this can change

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.