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

jakob_mostert's avatar

Deploy Laravel in Subdirectory

I am trying to host my laravel app on a plesk webserver. Since I'm on a Plesk Obsidian license I don't have any access to creating virtual hosts or modifying anything about the server. Here's my setup: I have one domain under which my company setup the folders 'apps' and 'whp' (./httpdocs/apps and ./httpdocs/whp). I also have access to my root directory and an ssh connection. I can't however access php or composer from cli. My company requires me to host all possible web applications under that one domain either inside/apps or /whp. I therefore decided to put all my laravel app's files and directories into ./laravelApp inside the root directory. I then created a symbolic link from ./httpdocs/apps/laravelApp to ./laravelApp/public and set a my appUrl inside .env to mydomain.com/apps/laravelApp. Additionally I added rewrite Base /apps/laravelApp to the .htaccess file inside the public folder. If I then enter mydomain.com/apps/laravelApp inside the browser my home page is displayed correctly. On that page is a form that has the hardcore action="/authenticate" set. If I submit the login form I am however redirected to mydomain.com/authenticate and not to mydomain.com/apps/laravelApp/authenticate. I am not using named routes in my app. For forms I just hardcode the url and for redirects I use redirect("/test"). Can someone help me resolve this?

0 likes
4 replies
johndivam's avatar

htaccess

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /apps/laravelApp/

   # Other rules...
</IfModule>

php artisan config:clear

jakob_mostert's avatar

@johndivam I set those. And unfortunately I cannot access php via cli. I can't execute any artisan nor composer commands.

jakob_mostert's avatar

@jlrdw that I can but php isn't in the server path so I can't run any php or composer commands via the ssh connection.

Please or to participate in this conversation.