I have a website that is currently migrating from an old CMS to a new one (Laravel). Only some languages of the website have been moved to Laravel. So basicaly, my root folder of the vhost has something like this:
[D] staticContentDirectory1 [D] staticContentDirectory2 ... [D] oldCmsDirectory1 [D] oldCmsDirectory2 ... [D] oldCmsDirectoryN [D] public [F] index-of-the-old-cms-still-in-use.php
I have a
.htaccess file that redirects everything that is not handled by the old CMS or in a static content directory to Laravel and looks something like this :
RewriteRule ^((?!staticContentDirectory1|staticContentDirectory2|public)(.*))$ public/$1 [L]
There is also a
.htaccess in public, from Laravel, to handle its stuff.
So far, everything is working perfectly fine and we were pretty happy with the result (given the initial constraints).
We discovered an issue though. Somehow, Google managed to discover that
/public exists and crawled it, which lead to the URL with a
/public/ inside, which since then had created
/public/public/ URLs (which, fortunately, returns a 500 error and avoided an infinity of URLs).
Before fixing the CMS and
robots.txt we tried to fix that by rewriting/redirecting traffic from
A lot of things were tried, a lot of failures happened, almost all in an infinite loop of redirects.
Because every Apache module seems to do its stuff on his own, mixing
RewriteRule were either an infinite redirect or totally ignored.
TL;DR: I'm asking for help now : how can one have a RewriteRule to a
/folder and yet redirect all traffic from that folder to the root.