0
votes

My hosting provider doesn't allow me to upload files on root. It only give access to public folder. I tried to move index.php & .htaccess files from Project's public directory to Server's Public Directory. It temporarily solve the problem. But I have to change every single file structure. Otherwise it doesn't find link. So please suggest me to upload my Laravel Project on such Host.

1
You'll have to add a .htaccess file in your public folder with proper rewrite rules. Check stackoverflow.com/questions/23837933/… .Bharat Geleda

1 Answers

0
votes

Try this in your .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

Of course, replace domain-name.com with your actual domain.

What this does is, it internally forwards all requests to your public folder. For example www.domain-name.com/lorem-ipsum will be redirected to www.domain-name.com/public/lorem-ipsum.

However, I have not tested this but it should work well in theory.