2016-03-05 68 views
0

我使用RACK在heroku上部署靜態網站(https://sixth-group.herokuapp.com/)。 它的效果很好。 但是,當我點擊鏈接它不起作用,其他網頁不會出現? 任何人請幫助!靜態網站鏈接在Heroku上不起作用

+0

的可能的複製[是否有可能上傳一個簡單的HTML和JavaScript文件結構的Heroku?](HTTP:/ /stackoverflow.com/questions/10551273/is-it-possible-to-upload-a-simple-html-and-javascript-file-structure-to-heroku) – reinder

回答

0

這對Heroku完美適用於我。

HTML:

<a href="/contact.html"> Contact Us </a> 

Config.ru

use Rack::Static, 
    :urls => ["/images", "/js", "/css"], 
    :root => "public" 

static_page_mappings = { 
    '/'    => 'public/index.html', 
    '/contact.html' => 'public/contact.html' 
} 

static_page_mappings.each do |req, file| 
    map req do 
    run Proc.new { |env| 
     [ 
     200, 
     { 
      'Content-Type' => 'text/html', 
      'Cache-Control' => 'public, max-age=6400', 
     }, 
     File.open(file, File::RDONLY) 
     ] 
    } 
    end 
end