Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 728647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:42:19+00:00 2026-05-14T06:42:19+00:00

You can serve static files with Sinatra by placing them in public/ (by default)

  • 0

You can serve static files with Sinatra by placing them in public/ (by default) — I have an index.html in there at the moment, but how can I make the root point to that file without having to parse it as a template?

To be clear, I can access /index.html successfully, and I’d like to route / to be the same static file, but without redirecting. Any idea how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:42:20+00:00Added an answer on May 14, 2026 at 6:42 am

    Probably a better answer will eventually come, until then this is my shot at it.

    If this is not what you want:

    get '/' do
      redirect '/index.html'
    end
    

    You might do something like this:

    get '/' do
      File.new('public/index.html').readlines
    end
    

    I’d go with the first one though, Not sure why you want to avoid that redirect

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sinatra can serve files from a static directory with the set :public, 'your_directory' command,
How can I serve some static content in liferay? I have a directory structure
(r'^media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT}), As you can see, I have a directory called media under
Can ASP.Net routing (not MVC) be used to serve static files? Say I want
In a system that I'm building I want to serve Static files (static HTML
Comet Server Orbited can serve static files from paths specified in it's config file
My static files serve great on the development server, but when I deploy my
How can i use Tomcat to serve image files from a public folder outside
I have several CSS files listed in my base.html, and while one of them
nginx is a killer static file server. it can serve node.js , as in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.