
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
- Insert dummy data in users table Laravel
- How to set column as primary key in Laravel model
- Laravel form request validation
- SQLSTATE[42000]: Syntax error or access violation: 1055
- How to insert dynamic value to additional column in pivot table in laravel
- How to add foreign key in laravel using migration
- How to create new user without form submission in laravel
- Class 'Facade\Ignition\IgnitionServiceProvider' not found
- Add class to body in laravel view
- On delete set foreign id column value null using migration in laravel 8
- Laravel file size validation not working
- Permanently delete a record in laravel
- Trying to get property 'title' of non-object
- RuntimeException You must enable the openssl extension in your php.ini to load information from https://repo.packagist.org
- Insert Comma Separated Values in laravel
- Update if exist else insert new record in laravel
- The POST method is not supported for this route. Supported methods: PUT.
- Page loader in laravel
- Display data in table using foreach in Laravel
- How to get last month records in Laravel
- How to validate form input data in laravel
- How to create and run user seeder in laravel
- Generate unique username in Laravel
- Get count of filter data, while return a small set of records
- Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails