I am currently in the process of moving a large number of subdomain websites to become sub directory websites. e.g. site1.website.com => website.com/site1. All of these sites use the same code in the same directory. The code will read the site name and load the correct database if it exists. So i have the following alias formatting for all sites.
Alias /site1 /var/www/laravel/public
Without needing to explain too much, laravel is an MVC framework and index.php is the only file that i need to route traffic through. Because of this all of the URLS need to have index.php as a prefix, but this is really ugly and i cant seem to get rid of it.
I tried the following which worked when the website was a subdomain, but it doesnt work now. When i use this code website.com/site1/login will redirect to website.com/login.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
All websites are dynamic so i dont want to hardcode a rule for every single website. Is there a way i can handle this?