Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

athomas1's avatar

Laravel 5 deployment shared hosting

Hey, I have been trying to get my website up and running through asmallorange hosting. My folder set up is like the following:

laravelProject
-----website
-----------(all files associated with the laravel app)
public_html
-----.htaccess
-----public
----------index.php ----------(All public files associated with project)

The .htaccess file is as follows: AddType application/x-httpd-php56 .php

RewriteEngine on

Change domain.com to be your primary main domain.
RewriteCond %{HTTP_HOST} ^(www.)?domainname.org$

Change 'subfolder' to be the folder you want to redirect request to.
RewriteCond %{REQUEST_URI} !^/laravel/website/

Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

Change 'subfolder' to be the folder you want to use for your primary domain.
RewriteRule ^(.*)$ /$1

Change domain.com to be your primary domain again.
Change 'subfolder' to be the folder you will use for your primary domain followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?domainname.org$
RewriteRule ^(/)?$ /public/index.php [L]

When I go to www.domainname.org the website will load the view but will not load the public folder files associated with the files. When I go to www.domainname.org/public/ it loads the view and loads the public folder files associated with the view (Yay!). When I click on any other links, however, non of them work(Will not load the view, or anything else). Its like it is not going back to my routes file and finding the appropriate path. Any advice would be great, thank you.

0 likes
3 replies
jjosephs's avatar

Following, asmallorange was one of my candidates for shared hosting.

sid405's avatar

@athomas1 In public/index.php

require __DIR__.'../website/bootstrap/autoload.php';

$app = require_once __DIR__.'../website/bootstrap/app.php';

Have you already done this modification?

Is there a way i can check this url live?

athomas1's avatar

Sorry to dig this back up as I've moved on to using digital ocean but just for others who find this and maybe want to know some more info on this situation. I did have the correct modifications as specified above. The routes were being called because the view was being created at www.website.com but the public files were not being called. They were only being called at www.website.com/public/ Thus each was displaying differently. The url's were not being generated correctly in either case as clicking on a link (on either of the pages) yielded a 404 page. Neither worked but the url's on www.website.com/public/ yielded url's of www.website.com/page instead of www.website.com/public/page

Please or to participate in this conversation.