0

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

2 Answers 2

1

Instead of using:

<?php include_once("home.html"); ?>

this worked perfectly

<?php include_once("./home.html"); ?>
Sign up to request clarification or add additional context in comments.

1 Comment

Happy to hear it was just that!
0

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.

1 Comment

Thanks, but if I don't add php script I won't be able to deploy it to heroku

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.