I can’t upload my Laravel site because it won’t let me create a folder outside the htdocs directory. I need to host my public folder in htdocs, but the rest of the Laravel files can’t go in htdocs; they have to be outside of it. It won’t let me upload files from outside or do anything else, saying it’s for hosting security reasons.
Welcome to the InfinityFree community forum! Good to have you here.
Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
Solving an issue is a joint effort. Try the suggestions you get and report back what happened.
Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.
Tu mensaje está en español, pero en este foro respondemos en inglés, así que va en inglés.
You can’t put anything outside htdocs on InfinityFree, and you don’t need to. The web root is always the htdocs folder of your account and can’t be changed. PHP is also restricted to files inside htdocs, so moving the Laravel code elsewhere won’t work.
The fix is to upload the whole Laravel project, public folder included, into htdocs. Then add a .htaccess file directly in htdocs with these two lines:
RewriteEngine On
RewriteRule (.*) /public/$1 [L]
That sends every request through public. Requests for private files like /.env become /public/.env, which doesn’t exist, so visitors get a 404 instead of your credentials.
The article also covers the following:
Running composer install --no-dev and compiling your assets locally before uploading.
Not uploading node_modules.
Replacing storage:link with a rewrite rule, because symlinks aren’t supported.