Ok, this is what is happening.
I've created a small laravel app (actually, still it's on the development stage).
When I upload it to the server (shared hosting managed through cPanel) I've deployed it to a subfolder inside the main website.
There is the main website (a WordPress) on the server's public_html folder, so I created a subfolder where I put my app.
Now, when you request http://oursite.com you reach the Wordpress site. And when you request http://oursite.com/laravelapp you reach the initial page of the laravel app.
However, when I try to browse any page into the app, the routing returns me to routes inside the root web folder.
For example, if I push the login button, the petition to http://oursite.com/laravelapp/login redirects to http://oursite.com/login, and obviously, the page load fails
The funny thing is that if I reach directly public pages, it seems to work fine.
If I directly request http://oursite.com/laravelapp/public/index.php and push the same login button, a request to http://oursite.com/laravelapp/public/index.php/login is made, and it works!! Even JS and CSS links are correctly detected on that request!!
I suspect this is probably something quite stupid that I cannot see now because I'm too tired, but I will really appreciate any insight on the matter.
The index.php on my laravelapp folder is the following:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
And this is the code of the .htaccess file inside /laravelapp/public folder:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Maybe I would be able to fix this using a subdomain like myLaravelApp.oursite.com?
.htaccess
file inside your public folder?