Lubos Rendek

The only solution is determination.

How to Hosts a Static Website on Heroku for FREE

| Comments

Here is a simple guide on how to host a static website on Heroku git repository. To do this you will need a user account on Heroku. If you do not have one already please register one before you continue reading.

Once you login to your Heroku account the first thing you need to do is to create project/app. In our example we are going to call our app “mysite”. Note, your app must have unique name !

Next clone your local app development:

1
git clone git@heroku.com:mysite.git -o heroku

At this stage navigate to your mysite directory ( your directory name will be different ):

1
cd mysite

Create your simple index.html file:

1
echo "My site on heroku git repository" > index.html

Since Heroku will allow you host only applications you need to wrap your index.html into PHP index.php file:

1
echo '<?php include_once("index.html"); ?>' > index.php

Next, add your files to git repository and commit code:

1
2
3
git add .
git commit -m "my static website initial upload"
git git push heroku master

At this point your are done with uploading. Navigate to your Heroku repository URL using your browser and you should see “My site on heroku git repository” as a front page.

Comments