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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:33:39+00:00 2026-06-18T06:33:39+00:00

I assume this is not really a difficult issue but I am using so

  • 0

I assume this is not really a difficult issue but I am using so many different solutions and don’t really know what it best.

I am using Ruby on Rails and have my apps on Heroku and I want to 301 redirect everything on my naked domain (@) to my www-domain. E.g.

http://domain.com –> http://www.domain.com
http://domain.com/subpage –> http://www.domain.com/subpage

Right now I am handling this with my DNS by first deleting both @ and www entries. Then I set a redirect of the entire website to http://www.domain.com (which re-creates the DNS entries for both @ and www). Lastly I change my www DNS-entry to CNAME and the name of the heroku-app (http://myapp.herokuapp.com).

This seems to be forwarding http://domain.com/subpage to http://www.domain.com (without the subpage).

What I am looking for now is the proper/recommended way to handle this in a simple/elegant way.

DNS?
Routes?
.htaccess? (if so, how do I alter .htaccess in RubyOnRails)

Thanks in advance!

  • 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-06-18T06:33:41+00:00Added an answer on June 18, 2026 at 6:33 am

    In the end what I had to do was to point the @-DNS to my normal web host (since @ demands an IP and Heroku will only accept CNAME) and the www-DNS to Heroku.

    At my normal webhost I put a .htaccess that redirected all traffic there to my www-domain like this:

    RewriteEngine On
    
    ### re-direct to www
    RewriteCond %{HTTP_HOST} ^domain.com
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this defensive-programming issue that I don't really know how to solve. I
I know this is normally rather stupid, but don't shoot me before reading the
(For the purposes of this question, let us assume that one is intentionally not
I assume this is really easy, and I'm missing something obvious. I'm connecting to
Let's assume this scenario in Visual C++ 2010: #include <iostream> using namespace std; struct
I've never done anything like this, so I'm not really sure what kind of
I'm not sure, if this is really a question or more an observation -
I've already asked similar question on this issue on stack overflow already, but I
I think different machine has different answer for this, let me assume this test
I'm studying for an exam, and I'm not really sure how to portray this:

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.