* Problem serving static site
@ 2010-05-08 13:32 millisami
2010-05-08 16:21 ` millisami
0 siblings, 1 reply; 2+ messages in thread
From: millisami @ 2010-05-08 13:32 UTC (permalink / raw)
To: Rack Development
The following is the dir structure of the folder site.
├── config.ru
├── README
├── site
│ ├── about_us.html
│ ├── contact_us.html
│ ├── images
│ │ ├── bags
│ │ │ ├── bag1.jpg
│ │ ├── button.png
│ ├── index.html
and this is config.ru
#Use the regex to serve everything from :root directory
#use Rack::Static, :urls => [/./], :root => "site"
require 'rack-rewrite'
use Rack::Static, :urls => ["/stylesheets", "/images", "/
javascripts"], :root => "site"
#use Rack::Static, :urls => [/./], :root => "site"
run lambda { |env| [200, { 'Content-Type' => 'text/html', 'Cache-
Control' => 'public, max-age=86400' },
File.open('site/index.html', File::RDONLY)] }
When I run it, the index page is served and when I navigate to Contact
page, i.e. /contact, the url is consumed and returned 200, but the
content is still the same page.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem serving static site
2010-05-08 13:32 Problem serving static site millisami
@ 2010-05-08 16:21 ` millisami
0 siblings, 0 replies; 2+ messages in thread
From: millisami @ 2010-05-08 16:21 UTC (permalink / raw)
To: Rack Development
Well I fixed this using the regular expression:
#use Rack::Static, :urls => ["/stylesheets", "/images", "/
javascripts", "/showcase.html", "/about_us.html"], :root => "site"
use Rack::Static, :urls => [/./], :root => "site"
On May 8, 6:32 pm, millisami <millis...@gmail.com> wrote:
> The following is the dir structure of the folder site.
>
> ├── config.ru
> ├── README
> ├── site
> │ ├── about_us.html
> │ ├── contact_us.html
> │ ├── images
> │ │ ├── bags
> │ │ │ ├── bag1.jpg
> │ │ ├── button.png
> │ ├── index.html
>
> and this is config.ru
>
> #Use the regex to serve everything from :root directory
> #use Rack::Static, :urls => [/./], :root => "site"
>
> require 'rack-rewrite'
> use Rack::Static, :urls => ["/stylesheets", "/images", "/
> javascripts"], :root => "site"
> #use Rack::Static, :urls => [/./], :root => "site"
>
> run lambda { |env| [200, { 'Content-Type' => 'text/html', 'Cache-
> Control' => 'public, max-age=86400' },
> File.open('site/index.html', File::RDONLY)] }
>
> When I run it, the index page is served and when I navigate to Contact
> page, i.e. /contact, the url is consumed and returned 200, but the
> content is still the same page.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-08 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-08 13:32 Problem serving static site millisami
2010-05-08 16:21 ` millisami
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).