My front-end project is based on 1 file: frontend/index.html
It means that every request like /contact
, /about
, etc should be responded by index.html
file.
I was thought I can use these lines in my httpd.conf
file with no any conditions:
<VirtualHost *:80> DocumentRoot "/var/www/frontend/" RewriteEngine On RewriteRule . /var/www/frontend/index.html</VirtualHost>
But I understood that any existing files (such as frontend/js/app.js
or frontend/favicon.ico
etc) will also be responded by the index.html
while they exist in real directories.
This is what I need:
Request: /contact
-> No frontend/contact
file -> Response: index.html
Request: /
-> No file requested -> Response: index.html
Request: /js/app.js
-> frontend/js/app.js
exists -> Response: frontend/js/app.js
etc.
What can I write in httpd.conf
file in above block to do such thing?
NOTE: I used VirtualHost
because I need the back-end
files in another port (:8080
) of server requests.