LMSouq
php-dev Open

How to remove /public/ from a Laravel URL

US
user1537360
1 month ago
3 views
Problem Description
I want to remove the `/public/` fragment from my Laravel 5 URLs. I don't want to run a VM, this just seems awkward when switching between projects. I don't want to set my document root to the public folder, this is also awkward when switching between projects. I've tried the .htaccess mod_rewrite method: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> but this gives me a Laravel NotFoundHttpException in compiled.php line 7610. In Laravel 4 I could move the contents of the public folder into the root. The structure of Laravel 5 is quite different and following the same steps completely broke Laravel (the server would only return a blank page). Is there a method of removing 'public' in a development environment that allows me to switch between projects with ease (I'm usually working on 2 or 3 at any one time)? I'm using MAMP and PHP 5.6.2

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base