Level 75
Document root should point to public. An example
<VirtualHost *:80>
DocumentRoot "C:/XAMPP/htdocs/projectname/public/"
ServerName projectname.dev
// other lines as needed
</VirtualHost>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I'm trying to set up a virtualhost so that I can run the application in a subfolder. His is the structure
test.com
-/laravel app
index.php
I have a virtualhost like this
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.com/
Alias /laravel /var/www/test.com/laravel/public/
<Directory /var/www/laravel>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ServerName test.com
ServerAlias www.test.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
In Laravel / public I added to .htaccess
Options -MultiViews
RewriteEngine On
RewriteBase /laravel/
So now when I go to test.com/laravel the application works but the routing doesn't work. I'm getting a server 404. Did I forget something? I tried different tutorials but I didn't run it. Can you advise me? Thank you
Please or to participate in this conversation.