title: Heroku + Rack-Rewrite
body: <p>Still can't get this working...Rails 3.1.3, Ruby 1.9.2 on Heroku's Cedar Stack.</p>
  
  <p>Trying to use <a href="https://github.com/jtrupiano/rack-rewrite" rel="nofollow">https://github.com/jtrupiano/rack-rewrite</a> to make <a href="http://domain" rel="nofollow">http://domain</a> 301 redirect to <a href="http://www.domain" rel="nofollow">http://www.domain</a> to no luck (app works, but no redirects happen at all).</p>
  
  <p>/config/initializers/rack_rewrite.rb (MyAppName is actually the correct name, domain.com is actual domain):</p>
  
  <pre><code>MyAppName::Application.config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
      r301 %r{.*}, 'http://www.domain.com$&amp;', :if =&gt; Proc.new {|rack_env|
      rack_env['SERVER_NAME'] != 'www.domain.com'
      }
  end
  </code></pre>
  
  <p>Added to Gemfile:</p>
  
  <pre><code>gem 'rack-rewrite'
  </code></pre>
  
  <p>Did "gem install rack-rewrite", "bundle install".</p>
  
  <p>No luck.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p><strong>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?</strong></p>