Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://stackoverflow.com/questions/28364496/laravel-5-remove-public-from-url
- =====================================
- 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:
- ------------------------------
- ON htaccess
- ================
- 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]
- STEP 2//
- That's working for me. But all resource files in /public directory couldn't find and request urls didn't work, because I used asset() helper.
- I changed /Illuminate/Foundation/helpers.php/asset() function as follows:
- function asset($path, $secure = null)
- {
- return app('url')->asset("public/".$path, $secure);
- }
- Now everything works :)
- Thank you @rimon.ekjon and all of you.
Advertisement
Add Comment
Please, Sign In to add comment