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 7077249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:23:55+00:00 2026-05-28T06:23:55+00:00

Still can’t get this working…Rails 3.1.3, Ruby 1.9.2 on Heroku’s Cedar Stack. Trying to

  • 0

Still can’t get this working…Rails 3.1.3, Ruby 1.9.2 on Heroku’s Cedar Stack.

Trying to use https://github.com/jtrupiano/rack-rewrite to make http://domain 301 redirect to http://www.domain to no luck (app works, but no redirects happen at all).

/config/initializers/rack_rewrite.rb (MyAppName is actually the correct name, domain.com is actual domain):

MyAppName::Application.config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
    r301 %r{.*}, 'http://www.domain.com$&', :if => Proc.new {|rack_env|
    rack_env['SERVER_NAME'] != 'www.domain.com'
    }
end

Added to Gemfile:

gem 'rack-rewrite'

Did “gem install rack-rewrite”, “bundle install”.

No luck.

Any ideas?

UPDATE:

I have figured out PART of the problem. Since I’m just trying to serve “index.html” and it’s “/style” folder, it appears that having “index.html” in “/public” overrides the rack-rewrite. If I remove “index.html”, the rewrites work…but now I don’t know where to put the files, or set up the routes.rb to direct to the index.html page by default…any help?

  • 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-28T06:23:56+00:00Added an answer on May 28, 2026 at 6:23 am

    change

    rack_env['SERVER_NAME'] != 'www.domain.com'
    

    to

    rack_env['SERVER_NAME'] == 'domain.com'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working at this all morning and I still can't find a way
I have searched for this, but still can't seem to get this to work
I've read this but still can't get it. I want to do is a
I've trawled for hours over this piece of jQuery and I still can't get
This is supposed to be a no brainer but I still can’t figure it
I've run the suggested commands found here but I still can't seem to get
I've read a couple of posts on this issue but still can't seem to
This question seems to be asked freqeuently over the internet but I still can't
I've seen the post that deal with this issue but I still can't solve
I saw other posts but still can't get my background image to scale correctly.

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.