Sunday, March 19, 2017

Same IP, multiple Laravel installs in sub directories. How to rewrite using .htaccess?

I am trying to figure out (learn) how to set up .htaccess so multiple Laravel installs could be run on the same IP by by using the URL (/site_1, /site_2) like:

http://xx.xx.xx.xx/site_1


So far what I have realized that subsequent request for resources (like: /css/app.css) don't pass the rewrite rules and are lost. I have tried the OR flag to tie the request somehow to the url but then rules gets mixed up.


How could I get this to work?

.htaccess:

RewriteEngine ON
Options +FollowSymLinks


RewriteCond %{REQUEST_URI} /site_1 [NC,OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$      /site_1/public_html/public/$1       [L]


RewriteCond %{REQUEST_URI} /aloe [NC,OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$      /site_2/public_html/public/$1       [L]



via Edmond Tamas

Advertisement