Support the ongoing development of Laravel.io →
posted 1 year ago

tvbeek liked this thread

1
moderator

Hello @barcovanrhijn it sounds as a frustrating situation.

Thanks for your detailed question and the list with what you've tried!

Some debug things I can think about are:

  • Can you open a file that isn't handled by Laravel (like robots.txt)
  • Do you see the routes if you run php artisan route:list on your server?
  • Do you have a domain name defined on your routes? (That is possible but can result in problems if you do it while it isn't needed)
0

@Tvbeec it's a pickle.

  • Can you open a file that isn't handled by Laravel (like robots.txt) Yes this works if I enter the url/robots.txt
  • Do you see the routes if you run php artisan route:list on your server? The routes list out correctly.
  • Do you have a domain name defined on your routes? (That is possible but can result in problems if you do it while it isn't needed) I'm using very plain routes without domains since I'm essentially building the static bits for this site and getting the deployment going before adding more complex bits.

Example Routes

Route::get('/', function () {
    return view('welcome');
});

Route::get('/about', function () {
    return view('about');
});

I'm considering All Routes except main give 404

So I'm currently testing some additions to .htaccess to see if this will solve the issue.

.htaccess

    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    # Testing -- Suggested symlink additions
       Options Indexes FollowSymLinks
       AllowOverride All
       Require all granted

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
Last updated 1 year ago.

sadorect liked this reply

1
moderator

Some strange things that could help (I found this type or problems both interesting and frustrating)

I see you use a relative path (I suspect from your root) Can you use an absolute path? ln -s /home/myuser/domains/example.com/laravel/public /home/myuser/domains/example.com/public_html/

What happen if you copy your public dir to your public_html and update the paths in index.php ? Like require __DIR__.'/../vendor/autoload.php'; will be require __DIR__.'/../laravel/vendor/autoload.php';

0

@tvbeek Thanks for this suggestion.

I ended up deleting the entire deployment. You're right the symlinks are messing things up. In the end my conclusion is that the webserver is not following the symlinks correctly.

After redeploying and copying the index out and correcting the paths and setting the storage link things work as they should.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.