lundi 29 février 2016

Laravel 5 shared host subdomain htaccess

Firstly because im on a shared host I cannot place contents of my public folder directly into root. I have to place the entire project into the public_html directory and use a .htaccess to point to the public folder like below (which works fine for a single Laravel project):

RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

I now created a subdomain with the host and it created a directory inside my public_html directory called store.domain.com. This will be for an entirely different Laravel project. If I place the regular folder structure with the .htaccess file into this subdomain folder I get a 503 error when accessing the subdomain. I spoke to the host and when they suggested removing the root .htaccess file the subdomain started working but the main domain fell over.

Ive been struggling for days now reading up various solutions to other peoples similar issues on WordPress but cannot get anything to work correctly. The solution below sort-of works but it keeps adding on the public folder to my URL for the subdomain (root domain project is working fine):

RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^store.mc.com
RewriteRule ^(.*)$ /public/$1 [L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^store.mc.com$
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ /public/$1 [L]

Anyone had this issue or know how to solve it? Very frustrating...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire