I would like to host my website from /src/index.html
So if you visit my website at https://example.com
, you will see the contents of /src/index.html
(without adding /src/index.html
to the url)
This is currently my file structure
I tried adding the following in my .htaccess file:
RewriteRule ^ src/index.html
That redirects correctly but also redirects all paths linking to any other files (like style.css) to src/index.html making them unusable.
Something like the following would work but it would change the url to example.com/src/index.html
while I would like it to stay at example.com
:
Redirect 301 /index.html /src/index.html
RewriteRule ^ src/index.html
This naturally rewrites everything. To rewrite requests for the root only then you need to match against ^$
instead.
For example:
RewriteRule ^$ src/index.html [L]