: Configure Apache to redirect all requests to index.html? A CentOS 7 server is hosting a web application in /var/www/someapp/public_html. Requests for mydomain.com get served the file located at
A CentOS 7 server is hosting a web application in /var/www/someapp/public_html. Requests for mydomain.com get served the file located at /var/www/someapp/public_html/index.html. The user can then navigate to several browser-routes that are defined in the JavaScript web application. However, when the user refreshes the browser from one of those UI-routes, apache replies with a message indicating that the requested url is not found on the server.
What specific config settings need to be changed in order for all routes sent to apache to be redirected to index.html?
More posts by @Dunderdale272
1 Comments
Sorted by latest first Latest Oldest Best
I do mine with a .htaccess file. In the DocumentRoot for the site, I create the .htaccess file and it in goes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
Per @StephenOstermiller 's comment below, you also need to make sure that AllowOverride All is set in the Directory stanza as well. While mine is set up that way, I forgot to add that in the post since it is part of my default config.... so @StephenOstermiller gets the credit for that part.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.