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.
Asked
Active
Viewed 119 times
0
-
You'll have to add a .htaccess file in your public folder with proper rewrite rules. Check http://stackoverflow.com/questions/23837933/how-can-i-remove-public-index-php-in-the-url-generated-laravel . – Bharat Geleda Nov 17 '15 at 19:25
1 Answers
1
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.

Rico Ocepek
- 767
- 6
- 20