RSS

Monthly Archives: May 2016

Laravel 5 – Remove public from URL

By: KA_lin

  1. Renaming the server.php to index.php (no modifications)
  2. Copy the .htaccess from public (like rimon.ekjon said below)
  3. 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]

Copy from: http://stackoverflow.com/questions/28364496/laravel-5-remove-public-from-url

 
Leave a comment

Posted by on May 5, 2016 in Laraval, PHP