23.Dec.2019
Laravel remove public from url

When you setup a new laravel website you want to get rid of that "/public" in the url. Here is a direct code which you can paste into .htaccess file of root to remove that annoying "public"
<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>
Or if you have domain access then you can just point your domain to public folder directly.
Leave a Reply
Enim tempor eget pharetra facilisis sed maecenas adipiscing. Eu leo molestie vel, ornare non id blandit netus.
Recent Posts
2.May.2023 | codedrill | Artificial Intelligence
OpenAI API
The OpenAI API can be applied to virtually any task that involves understanding or generating natural
2.May.2023 | codedrill | Artificial Intelligence
What is Chat GPT
ChatGPT is an artificial intelligence (AI) chatbot developed by OpenAI and released in November 2022. It is