My current website is hosted on a server with the URL as follows:
test1.test.com
However, I need to move it to another hosting service that does not support this configuration. I had to change the URL to:
test.com/test1
Everything seems to be working fine after the migration except for the CSS and JS files - I keep getting a 404 not found error.
I haven't made any changes to how I load the CSS files, it's still done like this:
<link rel="stylesheet" href="{{ asset('css/main.css') }}">
Does anyone have any suggestions on how to resolve this issue? I have tried adding "test1" before {{ asset('css/main.css')
}} but it has not made a difference.
For context, my source code is not stored in a subdirectory, the /test1 simply routes to a load balancer.
Below are the Apache2 settings for the Docker image:
<VirtualHost *:80>
DocumentRoot /var/www/html/web
<Directory /var/www/html/web>
AllowOverride None
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
ErrorLog /var/log/apache2/app_error.log
CustomLog /var/log/apache2/app_access.log combined
</VirtualHost>
The deployment is on a cloud server using a Docker image and locally it works fine regardless of how I access the website. Any suggestions or adjustments that might help fix the issue?