3

I recently created a website with laravel 4. I used XAMP to test my website on localhost and to make it easier I created a virtual host in the vhosts file which points to the public folder of my Laravel app. The website is working perfectly.

Now I rented a webspace at One.com hoster. I opened the webspace with ftp and when I came on the "root" but there weren't any folders so I guess that the root location is the public location? I don't for sure.

The normal structure of a Laravel app is like this:

--> app  
--> bootstrap  
--> public  
--> vendor  
--> other files

This doesn't work because I think that One.com doesn't use a public html folder. I tried to make it work but unfortunately. I moved the contents of the public folder to the root of my domain and moved all the other folders in a folder named core. Then I changed some config files index.php and paths.php but still it doesn't work.

The question is what do I need to change to my folder structure to let it work on this One.com webserver and which files I need to adapt (.htaccess, paths.php)? I would like to protect my private folders of course.

Thanks in advance.

2 Answers 2

5

Just place .htaccess file in the root folder with data below:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>
1
  • Absolute hero! I can confirm this works with L5.2. Is there a way to set this so the url doesn't have public in it? So not domain.com/public/ but simply domain.com
    – nclsvh
    Feb 19, 2016 at 0:17
1

one.com does use a public_html folder because that's where your files are served from. What you can't get to is your home folder. Xampp is a windows package - have you made sure your filenames follow case conventions? Windows being case insensitive, and Linux being sensitive.

2
  • 1
    When I access the webspace with FileZilla there is nothing to see and it says Remote site:/ so i'm on root level. When i put index.html and write something as a test it works... without a public_html folder. These folders and files were generated by laravel. Sorry I don't understand what that have to do with one.com :p. Thanks for quick response.
    – Sven
    Sep 29, 2014 at 16:03
  • 1
    Xampp is not only windows. It is also a package for Linux and MacOS. And case follows the underlying OS.
    – broch
    Jun 13, 2016 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.