Last Updated: January 15, 2020
·
12.52K
· rstacruz

Host a static HTML/CSS site in Heroku

touch index.php

Yes, that's all it takes. It tells Heroku that the site is a PHP site and that it will be hosted using Apache.

And yes, you can still have an index.html file. The .html file takes precedence over the .php one.

7 Responses
Add your response

My god. This is just superb.

over 1 year ago ·

Nice! Thank you

over 1 year ago ·

I think this will work if you add any character to that file. Last time I tried it didn't let me create the site.

over 1 year ago ·

I never tried heroku, even though I heard of it. This makes a little more sense now, makes me want to go try it out for myself :)

over 1 year ago ·

@rstacruz: Thank you. I use Heroku for a while, and always use Flask or Sinatra for tiny websites.

I would like to add a note, that you can use HTML on Heroku to send emails, or register users, through REST API's.

Examples:
1. Sendgrid - http://sendgrid.com/docs/API_Reference/Web_API/mail.html
2. MongoLab - https://support.mongolab.com/entries/20433053-rest-api-documentation

Disclaimer: I do not affiliate with any of these companies.

over 1 year ago ·

Sorry, noob here. Where do I put touch index.php? In my index.html file?

over 1 year ago ·

I like that you actually created a PHP project on Heroku with this command. You then created the html file for static site. You can do that on other PHP web hosts as well.

over 1 year ago ·