79436402

Date: 2025-02-13 14:00:48
Score: 0.5
Natty:
Report link

When you have structure like you said

/ mysite.com
 ├─ app
 │ ├─ index.html
 │ └ ...
 └ .htaccess

You need to make sure that all your requests asking for documents (text/html) sent to mysite.com/app and any subsequent segments, are being redirected to mysite.com/app/index.html. To set up this configuration, you need to add some RewriteCond in your .htaccess.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Browsers will specifically ask for HTML (among other things) on initial page load
  # That is, if the *user* tries to access a *nonexisting* URL, the app is loaded instead
  # but if a webpage attempts to load a missing resource it will return 404.

  # if (HTTP_ACCESS.contains('text/html') && file_not_exists(REQUEST_FILENAME))
  RewriteCond %{HTTP_ACCEPT} text/html
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} app [NC]
    RewriteRule ^app/.*$ /app/index.html [E]

  # If you have a fallback document under mysite.com directory.
  RewriteRule ^ - [L]
</IfModule>

Special thanks to VLRoyrenn for the explanation, you can find the answer here.

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Starts with a question (0.5): When you have
  • Low reputation (1):
Posted by: batucha