Yalcin Yalcin - 1 year ago 107
PHP Question

Changing base url of localhost

I am learning PHP and Laravel. Until now I always implemented frontend and never had to do backend and never had to configure apache. I think my problem is a very easy one but I didn't know how to fix, because I didnt know what keyword I should search for.

My problem:

I am implementing two projects. One is called LearningLaravel and the other one is called MyFirstPHPage. In both projects I am using Laravel for backend, Angularjs for frontend and XAMPP for apache.

My problem is that I want to change the base url of both pages.

For example when I want to show the settings view of the first project I have to go to the url


and for the second page to


But I only want to type something like




for the settings of the first project and




for the second project. How can I achieve this? Links to tutorials would be ok too.

Thanks in advance

Answer Source

Create virtual host for Laravel project:

<VirtualHost some.app:80>
    DocumentRoot "C:/LaravelProject/public"
    ServerName some.app
    ServerAlias some.app

    <Directory "C:/LaravelProject/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

Then add to Windows hosts file something like this:

localhost    some.app

Restart Apache and use http://some.app/settings instead of localhost/MyFirstPHPage/resources/views/welcome.blade.php#/settings

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download