Why can’t the web server find my route?

Asked

Viewed 2,127 times

2

I did the upload of a system in Laravel called android_api on the hostgator server, and configured in the public file.

Until the main page it works, where Laravel 5 appears, but when I put the route I created, it shows page not found.

I posted on the root of my server:

-> raiz
      |_ android_api
      |_ public_html
             |_ android_api (que é a pasta public)
                  |_ index.php

You can see here as Laravel finds normal, but I set the route I created /listService, given page not found.

My route is like this:

Route::get('/listaService', "GeralController@getServices" );

Locally works.

I see I have to set up a Virtual Host there in the server of the Hostgator, but I did not find this location.

Man .htaccess is like this:

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

    RewriteEngine On
    RewriteBase /android_api

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

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
  • Your RewriteRule ^(.*)/$ /$1 [L,R=301] wouldn’t have to be RewriteRule ^(.*)/$ public/$1 [L,R=301] ? See if this helps you: http://www.codegeo.com.br/2013/03/utilizando-htaccess-para-hospedar-uma.html

  • Only this htaccess was from the project, but I added in the server htaccess those settings that you indicated and worked. You can add as a reply. Thank you

  • Ball show then. I also had a similar problem in the past.

1 answer

3


Currently your Rewriterule is like this:

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

Since the index.php file mapped by the server as default file for search and upload is inside the directory public, therefore it is sufficient to make the following amendment:

RewriteRule ^(.*)/$ public/$1 [L,R=301]

For more information: http://www.codegeo.com.br/2013/03/utilizando-htaccess-para-hospedar-uma.html

Browser other questions tagged

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