I have a large Laravel / VueJS application. Although it's not finished 100%, everything so far is working as expected. The only problem I have at this point is URLs are working with the addition of the public folder
mydoamin.com/public/the/rest/of/the/url
as well as without
mydoamin.com/the/rest/of/the/url
The question + answer Avoid public folder of laravel and open directly the root in web server did not help that much. I believe it's something very simple I forgot in my .htaccess file?
Here is the content of the ./rootfolder/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://myracediary.com/$1 [R,L]
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Google and other search engines already crawled these URLs, even though I don't even know where the links to them should have come from in the first place:
Additional Info
Although the .htaccess files are similar in my local dev environment (LAMPP) and the production server (Centos 6, Apache), I actually get the desired 404 in my local environment using the paths with the additional /public/
folder, but not in the production environment.
After some playing around I found out that requests with the additional public folder just go past the .htaccess file in the root folder.
I've been trying to add a rule to redirect in the .htaccess file in that public folder as follows: no success though
RewriteEngine On
# Handle redirects if public folder is defined
RewriteCond %{REQUEST_URI} ^public
RewriteRule ^public/(.*)$ https://myracediary.com/$1 [R=301,L]