I'm making a Laravel project but I have a big problem, I can't remove the /public/ name from my URLs. I saw a solution to move some files from the public directory to laravel's root directory, but I also learned that this is an unsafe technique. So I need to solve this problem with .htaccess since I don't have access to apache.
I created a .htaccess in the root directory, but that just made it work without the public name in the URL, but the routes inside laravel still show the public name. please help. I tried using other htaccess rules to remove the full public, but internal routing for css, livewire, js, etc. files doesn't work because all of them have public urls.
<ifmodule mod_negotiation.c> Options -MultiViews </ifmodule> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ ^ [N] RewriteCond %{REQUEST_URI} (\.\w+$) [NC] RewriteRule ^(.*)$ public/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ server.php
I encountered the same problem and I had to move the path of the domain name settings from "public_html/" to "public_html/public". Then in your "public_html/public/.htaccess" file I have the following settings: