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
- Syntax error or access violation: 1072 Key column 'role_id' doesn't exist in table (SQL: alter table `users` add constraint `users_role_id_foreign` foreign key (`role_id`) references `roles` (`id`))
- Add a subselect based on relationship using withAggregate method
- How to get database name in Laravel 9 ?
- Permanently delete a record in laravel
- How to generate .env file for laravel?
- Laravel csrf token mismatch for ajax POST Request
- Call to undefined relationship [user] on model [App\Models\Post]
- Store logged in user details in session and display in view in laravel
- Class 'App\Providers\Auth' not found
- InRandomOrder() method with example in laravel
- How to pass query string with pagination in laravel
- Route prefix with auth middleware in laravel
- How to add class to tr in table using foreach in laravel
- How to get the random value form a specific column in laravel ?
- How to send ID to another page in Laravel
- How to increment column value of table in Laravel
- Add class to body in laravel view
- How to remove package from laravel
- Submit form without CSRF token in Laravel
- How to fill a column automatically while creating records in Laravel
- How to pass data to route in laravel?
- Get current month records in laravel 7/8
- Update last created record in Laravel
- Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found
- How to get single column value in laravel