0

I have recently deployed a Laravel project to my live web server via FTP (Filezilla). Inside my young1.org web root folder I have the subdomain folder bookings, which displays web content at http://bookings.young1.org. Inside that folder I have the folder, 'laravel' that contains my entire laravel application, and inside that folder there is a 'public' directory.

I have imported my local database to one of the database accounts on the live web server via phpmyadmin, and I have switched the 'DB' credentials to point to the new database inside the env file in the laravel project root (changing the following variables: DB_DATABASE, DB_USERNAME, DB_PASSWORD).

When I navigate to http://bookings.young1.org/laravel/public, the home page of my application appears, fine and dandy. However, when I click on any of the internal links (e.g. the login and register) buttons, I just get a series of blank pages, and none of the internal pages appear.

Would anyone be able to take a guess at what the problem might be?

I have tried altering the .htaccess file to look like the below, and changing my 'PATHS' variable inside public/index.php.

Thanks,

Robert London, UK

// public/.htaccess

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

RewriteEngine On
RewriteBase /

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

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

// public/index.php

require DIR.'/../laravel/bootstrap/autoload.php';

$app = require_once DIR.'/../laravel/bootstrap/app.php';
Robert Young
  • 523
  • 1
  • 8
  • 22

2 Answers2

0

do you have SSH on the server? if yes did u install laravel as you're supposed to, also could you include the .env file contents, you can mask out the DB username and pass and the key you had to generate

never mind my mistake, i clicked on a link and got a SQL connection error (refused)

i still need to know if you installed laravel via SSH or that you just made the public folder the root, because if that's the case laravel cant help you with that (you need a VPS and not a webhost that only supports FTP as far as i know)

and to be sure

BE CAREFULL!!!

you have SQL connection errors that show credentials

Jesse
  • 39
  • 8
0

Notice that your URLs work fine if you use index.php in them, i.e.: http://bookings.young1.org/laravel/public/index.php/register

To allow URLs without index.php the mod_rewrite module on your Apache web server must be enabled.

First try to add this line in your .htaccess file of Laravel above RewriteEngine On:

Options +FollowSymLinks

This directive is needed to enable mod_rewrite in .htaccess context.

If it doesn't work after this, then you can check if module is enabled on your web server, the easiest maybe is to paste this in the beginning of index.php in public folder:

phpinfo();

Then open any page and search for mod_rewrite on the page, and see if you can find it under Loaded Modules. If not, you have to enable it.

To do that, if you can access through SSH you can do:

sudo a2enmod rewrite
sudo service apache2 restart

For more help on enabling mod_rewrite on Apache web server, check this answer.

Community
  • 1
  • 1
MBozic
  • 1,132
  • 1
  • 10
  • 22