So I am trying to deploy static website to heroku but the main page isn't loading the html/css files.
Link to app: https://randomstockpicker.herokuapp.com/
when I looked at the source code it shows:
<?php include_once("home.html"); ?>
this php code isn't loading the "home.html" file, the file exists and is uploaded as well.
I also got composer.json: {}
I followed this tutorial: https://medium.com/@agavitalis/how-to-deploy-a-simple-static-html-website-on-heroku-492697238e48
Instead of using:
<?php include_once("home.html"); ?>
this worked perfectly
<?php include_once("./home.html"); ?>
The tutorial you followed asks you to rename the index.html file to a custom one (home.html), and uses a PHP file (which is a server-side scripting language) to "load" the static file.
It's not rendering the page because Heroku isn't configured to serve PHP files.
I recommend you mv home.html index.html
(renaming you homepage back to index.html, which is a standard file that browsers look for) and you should see your static site.
Just as a side-note, PHP is not static, it's a dynamic scripting language, so if you're aiming at building a static site, avoid anything else than HTML + JS + CSS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.