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 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 two different Rails application speaking with each other through API calls. Gone
We are developing an application that has an iPhone client, and a Rails server.
I'm starting to use simple_form for a rails application, and while converting some of
I'm currently writing unit tests for my Ruby on Rails application, and one of
Hi I need to build an ruby on rails application which will call every
In my Rails 3 application users can write messages/posts in forum. I would like
while attempting to run rake, I run into the following error: heroku rake db:migrate
I need some gem/plugin to create an Excel spreadsheet with formulas to use in
I've got a problem with Spork test server. If I set config.cache_classes = false
I'm having a really frustrating issue: Rake is being dumb. Here's how the problem

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.