Mario
Mario

Reputation: 1253

What kind of server configuration is needed to have a laravel app working

Using cpanel I have upload into a server a laravel application. During the development I have used MAMP and it works fine.

When I upload the application into my host server, I only can see the first page:

http://myurl.com/appname/public/ 

When I try to navigate I always get this error:

Not Found

The requested URL /myurl.com/appname/public/account/sign-in was not found on this server.

What is the problem? Are there any special configuration for laravel applications?

Edit: .htaccess file content:

Options -Indexes
SetEnv DEFAULT_PHP_VERSION 55

I tried to add RewriteBase /like this:

Options -Indexes
SetEnv DEFAULT_PHP_VERSION 55
RewriteBase /

But it didn't work either.

I'm using this host https://www.ecowebhosting.co.uk/?page=webhosting&tab=advanced

Upvotes: 0

Views: 404

Answers (1)

Alana Storm
Alana Storm

Reputation: 166046

You didn't mention which web server you're using, but if it's apache, it looks like you need to either

  1. Tell Apache to process .htaccess files (so it can see the rewrite rules that pass everything to index.php

  2. Turn on the mod_rewrite module, which is the module that does the work of rewriting URLs

When you request a URL like

http://example.com/appname/public/account/sign-in

in a Laravel application, the rewrite rules turn that in

http://example.com/appname/public/index.php/account/sign-in

Behind the scenes. It looks like your server isn't setup to do this. Also, since you're serving Laravel out of a non root folder, you may need to set the RewriteBase. However, generally speaking, the ideal Laravel setup is one where the public folder is your web root. If possible, I'd configure your server so that's true as well.

Upvotes: 2

Related Questions