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

jorgehgm's avatar

Laravel/inertia/vue deployed on apache subdirectory repeats app-name.

I am trying to deploy a larave/inertia/vuel project on apache in a subdirectory of /var/www/html - let’s call it “myapp”.

On the browser: /myapp shows up as /myapp/myapp, repeating myapp.

The Virtual host settings on 000-default.conf are as follows: <VirtualHost *:80>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

 <Directory /var/www/html>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Require all granted
 </Directory>

 Alias /myapp /var/www/html/myapp/public
 <Directory /var/www/html/myapp>
    AllowOverride All
    Options -Indexes
 </Directory>

The .htaccess on myapp/public is the original with the following line added: RewriteBase /myapp/

Everything works fine in myapp except, for example when showing an item like myapp/myapp/users/3 and refresh the browser, I get “404 not found” because the working link should be myapp/users/3 without the repeated myapp.

Is there a way to setup the deployment so it does not repeat myapp and when I type myapp it actually is myapp?

0 likes
2 replies
jorgehgm's avatar

Thanks for the suggestion. I did try it in the public/.htaccess and got 500 (Internal Server Error). When i put it under myapp/.htaccess, I don't see any difference. myapp is still repeated myapp/myapp and some of the laravel redirect (like errors) don't work because the urls are wrong.

Please or to participate in this conversation.