Laravel 5 - Remove public from url and run without php artisan

In the beginner tutorial learn how to run laravel project without php artisan.

In laravel it's easy to step to run laravel project without using php artisan serve and removing public from url also


Here are the steps to follow.

1. Renaming the server.php to index.php



2. Copy the .htaccess from public folder to root folder (example : admin main folder)

3. Changing .htaccess to add following code:


RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)/$ /$1 [L,R=301]RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_URI} !^/public/RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]

No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...