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.
Written by Rico Sta. Cruz
Related protips
7 Responses
My god. This is just superb.
Nice! Thank you
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.
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 :)
@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.
Sorry, noob here. Where do I put touch index.php? In my index.html file?
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.