vfsoraki
vfsoraki

Reputation: 2307

Using .htaccess to remove folder from URL

I have a Laravel app, and the document root of host is configured at Laravel root folder (upper directory of public).

I tried the following .htaccess to silently rewrite URLs, but it keeps redirecting me to /public, instead of showing domain URL and rewriting it to /public

RewriteEngine On
RewriteRule ^(.*)?$ /public$1 [L,NC]

I want to visit example.com and see my Laravel app, not redirecting user to example.com/public.

Upvotes: 1

Views: 131

Answers (2)

Alupotha
Alupotha

Reputation: 10103

This will help you definitely : Removing the /public segment in a Laravel 4 app

http://creolab.hr/2013/03/removing-the-public-segment-in-a-laravel-4-app/

Upvotes: 2

Frank Bardon Jr.
Frank Bardon Jr.

Reputation: 145

Create a front controller in the document root, call it index.php. Use this front controller to invoke the front controller in the public folder. Make sure you add the .htaccess to that document root prohibiting all sensitive data from being accessed.

Upvotes: 0

Related Questions