Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point what configuration is probably preventing a Laravel site to work in web?

Hi Experts

Could you point  what configuration is probably preventing a Laravel site to work in web?

I developed a simple Laravel app in localhost.

I intend to test it under prodution.

My internet server provider had informed all it's needed to dispose that is still provided.

But the site doesn't work out.

Thanks in advance.
Avatar of William Nettmann
William Nettmann
Flag of South Africa image

You are not providing a lot of information.
  1. Does it work on localhost?
  2. What happens on the ISP's server?
  3. Providing a link to the site on the web may be a great help.
Avatar of Eduardo Fuerte

ASKER

Hi

Here it is:

1. Yes, it runs localhost.
2.
User generated image
3.
http://www.espiriplug.com.br/aplicacao-cliente/
In the meanwhile I change something

Introduce .htaccess   and  index.php  at the project folder

User generated image
Ok, let's walk before we run:

For this test, all you require in .htaccess is
DirectoryIndex index.php

Open in new window

For a Laravel app, you would normally have
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # 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>

Open in new window

To check if your web hosting setup is OK, create an index.php file exactly as follows:
<?php
phpinfo();

Open in new window

and nothing else.

Visit the URL and you should see your PHP config. If you don't, your web hosting setup is wrong.

Try that, and then we can go to the next step.
Hi

I eliminated the index.php at the app root

In the app root  .htaccess  just put:
DirectoryIndex index.php

Open in new window


Hostig is OK;
User generated image
The result is a blank page.
You are confusing me - the result looks like the PHP config, not a blank page.
Sorry.

What I mean is
1. The hosting is OK, accordingly with the php info image above.

2. Configuring  .htaccess  at the application folder with
DirectoryIndex index.php

Open in new window


User generated image
Eliminating the app root's   index.php

Eliminating the app root's   .htaccess

(Maintainig only the default index.php that is at Laravel's public folder)

The result is a blank page.
User generated image
Mistake:
Eliminating the app root's   .htaccess

Correct:
Eliminating the public folder   .htaccess

(accordingly with the picture)
ASKER CERTIFIED SOLUTION
Avatar of William Nettmann
William Nettmann
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I read.

I don't know if correctly understand,

If I have Codeigniter and pure PHP... in this site, a Laravel app could cohabit independently?
Hi

Since the subject derivated from the original purpose of the question I openned another question:

https://www.experts-exchange.com/questions/28954724/Could-you-explain-how-to-create-a-Linux-virtual-server-to-use-Laravel-on-the-WEB.html
Avatar of Oliver Russell
Oliver Russell

You could test out Laravel website with dedicated servers where you get staging url instead of shared server. Try out any laravel hosting provider that provides staging url. You can deploy your site there with git or sftp and test the site out.