Removing 'index.html' from my re-directed

2019-07-28 11:24发布

问题:

I'm using Heroku to deploy my site and have tricked it into thinking my static site is a dynamic one by including an index.php file that simply routes to my index.html. I've done this in order to simply host my site on Heroku, which apparently does not normally host static sites, just dynamic ones (to my knowledge).

QUESTION: How can I remove the index.html that comes out at the end of my website: www.roberttassy.co/index.html? In my code, I have an index.php file has the code block:

<?php header( 'Location: /index.html' ) ; ?>

which successfully re-routes to my index.html file, but I just don't want "index.html" to come out in my url in the address bar. I would like it to just read: www.roberttassy.co. Any suggestions?

回答1:

try with this

<?php include 'index.html';?>


回答2:

try to use this instead.

<?php require("index.html"); ?> instead of header.