I put my application in a subfolder "subfolder" of Apache so I can use a url such as: https://myserver.com/subfolder/#/v2/login instead of https://myserver.com/#/v2/login
I'm using the following Directory configuration:
Alias /subfolder /srv/apache2/htdocs/subfolder
<Directory /srv/apache2/htdocs/subfolder>
Order allow,deny
Allow from all
Options All
AllowOverride All
Require all granted
</Directory>
The problem is that now I have many broken links and not found resources showing errors such as:
https://myserver.com/app/v2/anotherfolder/anotherpage.html
Failed to load resource: the server responded with a status of 404 (Not Found)
Note that such links in the errors do not contain "subfolder" in the path.
What am I missing?
Inside your site root .htaccess (i.e. htdocs/
) use this rule:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?!subfolder/).* subfolder/$0 [L,NC]