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

nxtsdn's avatar

how to config Laravel 6 in subfolder domain?

hi, I have a Laravel 6 app which is working fine locally on redhat apache.

then it will deploy for production, and the domain will use subfolder, i.e https:// subdomain.com /folder

i put my project on root folder /var/www/folder/

In config/app.php I have

'url' => 'https:// subdomain.com /folder',

In folder/public/.htaccess I have

Options -MultiViews

RewriteEngine On

RewriteBase /folder

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)/$ /$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ index.php [L]

I can access https:// subdomain.com /folder and the page loads (without styles, images, ...). But all the other links to pages, images, css, js, ... are wrong. For example, they link to

https:// subdomain.com /css/style.css

instead of linking to

https:// subdomain.com /folder/css/style.css

i.e., "folder" is missing from all the links.

If I go to

https:// subdomain.com /folder/login

i got 403 error, but if i go to https:// subdomain.com /login, the page loads (without css,js)

So please how can it be done ? Can I have some .htaccess solution for this please ?

0 likes
0 replies

Please or to participate in this conversation.