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.
Pon todo el proyecto Laravel dentro de htdocs, no fuera. Con las reglas de .htaccess de abajo, el sitio funciona igual. En InfinityFree la raíz web siempre es htdocs y no se puede cambiar. Tampoco puedes crear carpetas fuera de ella, y por eso tu cliente FTP te lo impide.
Este artículo explica el proceso completo:
Resumen:
Sube el proyecto completo (app, bootstrap, config, public, storage, vendor, .env, etc.) dentro de htdocs. Antes, ejecuta composer install --no-dev y compila los assets (npm run build) en tu equipo. No subas node_modules.
Crea un archivo .htaccess directamente en htdocs (no en public) con este contenido:
RewriteEngine On
RewriteRule (.*) /public/$1 [L]
No borres ni modifiques el .htaccess que Laravel trae dentro de public. Los dos archivos trabajan juntos.
Según el artículo, esto también protege tus archivos privados. Una petición a /.env se reescribe a /public/.env, que no existe, así que el visitante recibe un 404 y no el archivo.
Si tu app guarda archivos en el disco público, el artículo explica cómo reemplazar php artisan storage:link, porque los symlinks no funcionan aquí. Además, trae los ajustes recomendados para el .env.
Si después de esto aparece algún error, copia aquí el texto exacto.