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

BrownieCoffee's avatar

403 Forbidden in shared hosting

Hi guys,

I definitivly have problem with my online website.

I'm obtaining 403 forbidden when I'm attempting to create project.

I have my app strucure like below

- /
	- goshr-core ( app folders and files except `public/` )
	-public_html/
		- goshr ( public content inside this folder)

I even don't know why.

Can you help me please?

Thank you in advance and S.U.+

0 likes
34 replies
laracoft's avatar

@browniecoffee

I vaguely recall you asked this before

\root-laravel-folder
├── app
└── public          <- DocumentRoot MUST point here, i.e. https://yourdomain.com
    └── robots.txt  <- MUST be able to load https://yourdomain.com/robots.txt
├── vendor
...
└── storage
BrownieCoffee's avatar

@jlrdw @laracoft Thank for your suggestion. But I worried about security if I follow this architecture


-/ (shared hosting root)

	- laravel_root_folders/
	
	- laravel_root_files

	- shared_hosting_folders/

	- public_html/

laracoft's avatar

@browniecoffee don't understand your structure

  1. Where is your intended Laravel root?
  2. Most of time, the folder can be anywhere, just don't put it anywhere near public_html
laracoft's avatar

@browniecoffee

This is safe.

  1. What is your concern?
  2. And what do you mean by laravel_root_files?

Take note of robots.txt and align your folders accordingly. DO NOT MOVE any laravel file or folder around.

\ (shared hosting root)
    - \root-laravel-folder
      ├── app
      ├── public          <- DocumentRoot MUST point here, i.e. https://yourdomain.com
      │   └── robots.txt  <- MUST be able to load https://yourdomain.com/robots.txt
      ├── vendor
      ...
      └── storage
    - laravel_root_files
    - shared_hosting_folders/
    - public_html/
BrownieCoffee's avatar

@laracoft like I'm using free shared hosting for exam, I'm worried about project security.

laravel-root-files are the files in laravel project root like composer.json, composer.lock etc...

What is robot.txt?

laracoft's avatar

@browniecoffee

  1. When you run composer create-project --prefer-dist laravel/laravel blog, it creates a blog folder, agree?
  2. We refer to blog as your Laravel root folder
  3. composer.json, composer.lock is inside blog, agree?
  4. There will be a file inside blog/public/robots.txt, agree?

Please indicate which point you don't agree.

laracoft's avatar

@browniecoffee great. Then you project is safe and will run properly, just make sure you point DocumentRoot to public and not blog

laracoft's avatar

@browniecoffee yes it will work provided you follow all instructions and especially do not move any Laravel file or folder.

On the other hand, I don't know what security you are concerned with. It is free, so planet hoster can do whatever they like and they can see all your files. But others won't be able to access your files.

BrownieCoffee's avatar

My members can create projects. When I'm trying to create one I'm optaining 403. @laracoft

The DocumentRoot ?

laracoft's avatar

@browniecoffee

I have specified the file location quite clearly. If you still don't understand, why did you agree to my 4 points earlier?

BrownieCoffee's avatar

@laracoft I don't think it's secure to give that in a forum. What do you need ? I can try to give you the answer

jlrdw's avatar

All I will add is the guide I shared with you is from @snapey site, and I have never had any problems following that guide for shared host.

Are you trying to install or are you uploading your project via FTP. But if you are having that much trouble why not set this project up on digitalocean or similar.

MarianoMoreyra's avatar

I don't think it's secure to give that in a forum. What do you need ? I can try to give you the answer

Are you kidding right @browniecoffee ? You shared your link in this other thread: https://laracasts.com/discuss/channels/laravel/font-awesome-and-images-not-displaying-in-my-online-project?page=1#reply=656055

Also, you’ve never replied to the help we were trying to give you in your other 2 posts. Like @jlrdw answer with deploy guide or my suggestions on how to move your installation to the root of your domain in a shared hosting

So I’m starting to believe you don’t really want / need help.

BrownieCoffee's avatar

@jlrdw I'll consider it

@marianomoreyra I have reupload my project in root instead of subfolder. So I applied your solutions. At any moment I give phpinfo informations. I don't know you talking about.

To finish, I think I have choice to answer you when I can.

'you also new replied to the help'. => Can you give me one moment ? I have many problems in progress so I think you can be patient or no reply to my issues if your not in ability to wait more than 5 to have answer ...

jlrdw's avatar

If that's a free host plan you probably will have to keep everything underneath public_html.

For a project that's not real world it would work but I wouldn't recommend it for a real world project that needs to be secure.

Next

Please or to participate in this conversation.