Removing 'index.html' from my re-directed PHP website url

你。 提交于 2019-12-24 16:22:19

问题


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.



来源:https://stackoverflow.com/questions/37289113/removing-index-html-from-my-re-directed-php-website-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!