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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:53:23+00:00 2026-05-21T10:53:23+00:00

I am writing an app that will use basecamp style subdomains ( See post

  • 0

I am writing an app that will use basecamp style subdomains (See post).

There are portions of the app that should always be in a subdomain and portions that should never be in a subdomain. For example, the “home” page should never be in a subdomain, but the blogs and posts resources always should. Keep in mind, I don’t know the subdomains, as there is one per account.

I set up my routes like this (example). It works well in that it matches the routes, but I am having difficulty forcing my app to link to the correct locations.

MyApp::Application.routes.draw do

  # these should all route to mysubdomain.myapp.com
  # Clicking on a post from myapp.com/categories/12 should take you to mysubdomain.myapp.com/posts/14
  constraints(Subdomain) do
    resources :blogs { resources :posts }
  end

  # these should all route to myapp.com (clicking on one of these links from mysubdomain.myapp.com should go to myapp.com/categories/12)
  constraints(NoSubDomain) do
    resources :categories
  end

end

The problem is that once I am in a subdomain, all of the links to the other pages (categories, etc) contain the subdomain. I am not sure the best to solve this issue. Thank you so much for your 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-21T10:53:23+00:00Added an answer on May 21, 2026 at 10:53 am

    It looks like could be done by overriding the url_for method to include a :subdomain option.

    See the Cleaning Up The Code To Change The Subdomain section of RailsCasts #221.

    Railscasts: http://railscasts.com/episodes/221-subdomains-in-rails-3

    ASCIIcasts: http://asciicasts.com/episodes/221-subdomains-in-rails-3

    Then you could do something like:

    <p><%= link_to "All Blogs", root_url(:subdomain => false) %></p>  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an app that will make use of multiple threads. There is
We are writing an app that will use T4 to generate Flex/Actionscript to compile
I'm writing an app that will need to make use of Timer s, but
I'm writing a web app that will use twitter as its primary log on
I am writing a web app that will use HTML to display a form.
I'm writing a Java ME app that will use privileged operations such as messaging.
I am writing an app that will use Reverse Geocoding to translate the user's
I am being tasked with writing an asp.net web app that will use ADFS
I am writing an app that will use the accelerometer to calculate the average
I'm writing an app that will basically be like Fraps, but it will push

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.