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

  • Home
  • SEARCH
  • 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 3755298
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:40:37+00:00 2026-05-19T09:40:37+00:00

For a Rails application hosted on Heroku, we are using Zerigo DNS Add-on to

  • 0

For a Rails application hosted on Heroku, we are using Zerigo DNS Add-on to point a custom domain (say mydomain.org) to point to the Heroku app. We have SSL certificate registered for mydomain.org

Now, we would want mydomain.com to redirect to mydomain.org. We tried implementing redirect rules at the controller/rack level. Doesn’t work. The browser URL still points to .com instead of .org

Has anybody faced the same problem with an Heroku app!!?

  • 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-19T09:40:38+00:00Added an answer on May 19, 2026 at 9:40 am

    I’ve used the following technique to redirect from “example.com” to “www.example.com” (as described here, http://docs.heroku.com/custom-domains). This might work in your case to redirect from .com to .org.

    In app/controllers/application_controller.rb:

    class ApplicationController < ActionController::Base
      protect_from_forgery
    
      before_filter :ensure_domain
    
      protected
    
      def ensure_domain
        if request.env['HTTP_HOST'] != 'www.example.com' && Rails.env.production?
          redirect_to "http://www.example.com", :status => 301
        end  
      end
    
    end
    

    In your case, you would point the DNS records for your .com and .org domains to your app running on Heroku. Your app would check the HTTP_HOST to see if it specifies your .org URL. If it does not, then it would redirect to your .org URL.

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

Sidebar

Related Questions

I have a rails application hosted on Heroku using a custom Domain. The application
We are currently working on a Rails application hosted on Heroku. We are trying
I have a rails app that runs on Heroku using their standard postgres database
I'm building a rails3 application (hosted on Heroku) and I'm using devise for user
I have a Rails 3.2 Application that is hosted on Heroku. I would like
I'm trying to implement thinking-sphinx across multiple 'sites' hosted under a single rails application.
In my rails application I have a rake task that reads emails using imap.
I have two rails applications, hosted on heroku, that need to communicate. For now,
I'm trying to use prawn, prawnto for generating pdfs in a rails application hosted
Cookies maximum size in rails application,as per rails guide it is 4 KB. http://guides.rubyonrails.org/security.html#session-storage

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.