![]() |
Best Way To Remove Public From URL In Laravel |
Best Way To Remove Public From URL In Laravel
Remove Public From URL Using htaccess In Laravel
Usually, This way is very useful for shared hosting.
You need to create a .htaccess file in your project’s
root directory and write the below code into it.
Try to access the URL and check public will be removed now.
<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 download .htaccess
2.
Post a Comment