1

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?

2 Answers 2

0

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]
Sign up to request clarification or add additional context in comments.

Comments

0

You can try to enter this below in your .htaccess file in your public directory in your "subfolder" directory. I assume that you already did the changed that you must have done in your virtual hosts file.

RewriteBase /subfolder (just below RewriteEngine On)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.