0

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?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
sicreep
  • 68
  • 8
  • 1
    `APP_URL` is only used for CLI purposes since there is no webserver that is passing the desired host – lagbox Dec 11 '19 at 16:24

2 Answers2

0

You should create a Vhost which should point to the public directory of you Laravel application.

It should look like this:

<VirtualHost *:80>
   DocumentRoot "path/to/laravels/public/dir"
   ServerName localhost
   <Directory "path/to/laravels/public/dir">
      AllowOverride All
      Allow from All
   </Directory>
</VirtualHost>

After this is done, the default .htaccess file will work and you have pretty url's.

bambamboole
  • 577
  • 10
  • 30
  • thanks @bambamboole. Would these settings really work? (sry I couldn't test them, because ervery change has to be requested to the administrator) For me these settings look like only working on localhost and only for my webpage but there are other webpages on this server too. My main problem is that the Laravel's URLs are pointing to the root of the server and not to the folder of my page – sicreep Dec 13 '19 at 20:02
  • hmm, the setup of the webserver can be so different... thats hard to say if this will work inyour environment – bambamboole Dec 19 '19 at 10:41
  • didn't work. But I've found the solution: https://stackoverflow.com/a/41018388/10558454 – sicreep Dec 23 '19 at 09:01
0

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>
sicreep
  • 68
  • 8