I need to force all requests regardless of what they are to index.html. Unfortunately everything I have tried has not worked properly.
The following seems to me like it should work but it doesn't. My understanding is that it is saying for anything that doesn't end in /index.html to actually request the index.html file.
Redirect 302 !^/index.html http://www.example.com/index.html
Any help/clarification would be greatly appreciated.
Using an .htaccess on the root folder this should do the job:
The condition and rule is that if the request does not match index.html it will redirect whatever to it
Answer of @prix is good. I myself needed to add conditions so that normal resources (images & css) are served as normal:
I voted up the other answers, but in the end they didn't quite help me because I included a logo in the index.html file. So here are my adjustments. First of all, the prerequisites.
Change
to
in
to enable .htaccess file in
/var/www/html
(example).Create or edit file
with content
As you can see, I'm not using a redirect. This means that the path or URI entered by the user remains the same; nevertheless, the index.html page is displayed with the logo.