Mobile app version of vmapp.org
Login or Join
Dunderdale272

: 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

@Dunderdale272

Posted in: #Centos #Configuration

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Dunderdale272

1 Comments

Sorted by latest first Latest Oldest Best

 

@Merenda212

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme