Laravel - The requested URL was not found on this server

Asked

Viewed 2,309 times

1

What I did

I made a form that registers the data in the database. Locally it worked perfectly.

Problem

It simply says it is not finding the URL. It is strange, because the error below says that the index.php of the public was not found, and if you are wondering, the action form is right, it’s calling the method gerarPdf.

The requested URL /var/www/Laravel/barcodeAssinatura/public/index.php was not found on this server.

url accessed

https://osite.com.br/pasta/barcode/

public/. htacces

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

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Routes.php

Route::get('/', 'HomeController@index');
Route::post('gerarPdf', 'HomeController@gerarPdf');

OBS: An Alias was created so that when accessing the site it calls the public/index.php.

  • I’m also having an error like this. The post route is returning error 301 Moved Permanently when I try to access by ajax. However the route exists and is found when sending the form via the browser url.

  • Is your server linux? did you check if apache mod_rewrite is enabled? The url you specified above does not match the data you reported from route.php

1 answer

2


i solved this problem by removing this line from . httaccess: RewriteRule ^(.*)/$ /$1 [L,R=301]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.