简体   繁体   中英

How do I add a page to my app developed using Heroku?

I am new to Heroku as well as Ruby and just created a new Facebook application using Heroku.

I created a clone of the git code in my local branch using Git Bash. After that, I made some changes in the index.rb file: I changed the background color of the app and deployed the updated code to git and the changes were reflected in the application.

I created a simple HTML file in the same folder as that of the index.rb file. Now I added a link to this HTML file, setting the href="/samplehtmlPage.html" in the index.rb file. I was able to successfully deploy the code and the link was reflected in my application, but when I clicked on it got a 'Not Found' error.

//inserted the below link after the body tag in the index.rb file
<a href="/samplehtmlPage.html">click here</a>

Could someone please help me understand how to add an HTML file to git, add a link in the index.rb and redirect to the new HTML file?

Did you use something like:

git add samplehtmlPage.html

prior to your git commit and git push ?

Without that, samplehtmlPage.html won't be part of the repo, nor will it get pushed.

如果您使用Ruby on Rails,则可以使用redirect_to方法,并使用以下代码替换代码(或修改您的控制器):

<%= redirect_to "/samplehtmlPage.html" %>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM