Youssef mahmoed
Youssef mahmoed

Reputation: 373

Laravel on shared hosting with Subdomain

I Have A shared host and i have made a laravel project and when i upload it to the host i made a htaccess file to redirect all requests to publc/index.php and it works very well and laravel project work good when i create a sub domain and but some files in subdomain's folder and try to access it i got a 500 Internal Server Error when i contaced the support they told me that this error because the .htaccess that i made i need help to solve this problem this is the structure of my public_html folder

-public_html
 |-laravelproject
   |- Laravel Projct Files
 |-subdomain
   |-index.php
 |-.htaccess

.htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^laravelproject/public
    RewriteRule ^(.*)$ laravelproject/public/$1 [L]
</IfModule>

Upvotes: 3

Views: 3428

Answers (1)

Erubiel
Erubiel

Reputation: 2972

Since subdomain is other installation i think you should add

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^laravelproject/public
    RewriteRule ^(.*)$ laravelproject/public/$1 [L]
    RewriteCond %{REQUEST_URI} !^subdomain/public
    RewriteRule ^(.*)$ subdomain/public/$1 [L]
</IfModule>

But im no .htaccess expert, hope it works!...

Upvotes: 1

Related Questions