Skip to content

Instantly share code, notes, and snippets.

Code is ART

Marwan Nabil marwan2

Code is ART
Block or report user

Report or block marwan2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
marwan2 /
Created Sep 21, 2019 — forked from bladeSk/
Deploying Laravel on a shared hosting using only .htaccess

Deploying Laravel on a shared hosting using only .htaccess

Making Laravel work on a shared hosting can be troublesome, because Laravel needs to have its document root set to the public directory. This may not be configurable by a user or even desirable, when the server is hosting multiple websites.

Here's a simple method using only a .htaccess file placed in Laravel's root directory - e.g. alongside app, bootstrap, config, ... No changes whatsoever are necessary to your code.

The file rewrites all the requests so that requesting /file.png would in fact return /public/file.png and anything else is routed to /public/index.php. This also ensures that nothing outside the public folder can be accessed, thereby protecting any sensitive files like .env or database/*.

The simple method

marwan2 / HomeController.php
Created Jun 12, 2019
RMS Single SignOn with Invoicing
View HomeController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Cookie;
class HomeController extends Controller
You can’t perform that action at this time.