Laravel 5 – Remove Public from URL
https://stackoverflow.com/questions/28364496/laravel-5-remove-public-from-url
127
I have solved the issue using 2 answers:
Renaming the server.php to index.php (no modifications)
Copy the .htaccess from public folder to root folder (like rimon.ekjon said below)
Changing .htaccess it a bit as follows for statics:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]
If there are any other static files needed just add the extension to the previous declared list
Last updated
Was this helpful?