laravelxampppretty-urls

pretty-urls not working with XAMPP and Laravel 5.8


I use Laravel v5.8 and I was happy to use it in VMware with Ubuntu. Now I needed to change to a Windows Server 2012 with xampp.

There is one thing I cannot eliminate:

I can visit my page over

https://fancysubdomain.fancydomain.de/myapplikation/public

I've created links like

<a class="title" href="/entries/create" > FOO </a>

These links go to

https://fancysubdomain.fancydomain.de/entries/create

(watch the missing "myapplication" block) and Apache tells me that the requested URL was not found.

If I type

https://fancysubdomain.fancydomain.de/myapplikation/entries/create

in the address field of the browser it also doesn't work.

In the .env file, I've set

APP_URL= https://fancysubdomain.fancydomain.de/myapplikation/

I've edited \conf\app.php to

'url' => env('APP_URL', ' https://fancysubdomain.fancydomain.de/myapplikation/'),

There are no virtual hosts set up in httpd-vhosts.conf (I am not the administrator). Do I need to set them up to get what I want? Do I need to set up something else?


Solution

  • I’ve finally found a solution. Thanks @J. Grunder stackoverflow

    After I had changed these settings, I ran into a new problem with my links. I had created links like

    <a href=”/entries/create”>Create Entry</a>
    

    Unfortunately, now the links pointed to

    https://fancysubdomain.fancydomain.de/entries/create

    (watch missing myapplikation element)

    Of course, I could handle that with

    <a href=”/myapplikation/entries/create”>Create Entry</a>
    

    But there could be some problems if the user is at that place.

    If somebody else runs in the same problem: Use Laravel’s URL helper:

    <a href=”{{ action('EntriesController@create') }}”>Create Entry</a>