
Remove public from url in laravel project
Remove public from url in laravel project
Through the use of the programming language, we will work together to solve the "Remove public from url in laravel project" puzzle in this lesson.
You can easily remove the public from URL in laravel. There are lots of ways to remove the public from the URL. The most convenient way is to use the htaccess file.-
Remove public from url in laravel using htaccess file in root directory of project
--PATH .htaccess<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> Options -MultiViews </ifmodule> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ ^$1 [N] RewriteCond %{REQUEST_URI} (\.\w+$) [NC] RewriteRule ^(.*)$ public/$1 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ server.php </ifmodule>
You have to copy-paste code snippets to your .htaccess file which you have to create in the root directory of your project. To access your images, scripts, and style files you have to move the CSS, JS, and images folder from the public directory to your root directory.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to pass variable from controller to model in Laravel
- How to get database name in Laravel 9 ?
- Insert values in pivot table dynamically in laravel
- How to add script on specific view file in laravel while extending layout
- Update email with unique validation in laravel
- Send OTP using textlocal api in laravel
- Laravel file size validation not working
- Count all and get 10 records after where condition in laravel
- How to upload image in laravel 8
- Pass variable from blade to controller Laravel
- How to get all posts which contains comments in laravel
- How to delete record in Laravel with ajax
- Update existing pivot table data in laravel
- Cannot end a section without first starting one
- Call to a member function getRelationExistenceQuery() on array in Laravel
- How to create static page in Laravel
- Remove array keys and values if it does not exist in other array in Laravel
- Attempt to read property "avatar" on null in Laravel
- How to create laravel project using composer
- Get count of filter data, while return a small set of records
- Show old value while editing the form in Laravel
- Create project table with model and migration
- Insert Comma Separated Values in laravel
- OrderBy on Eloquent relationships method in Laravel
- Recursive function example code PHP Laravel