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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:38:35+00:00 2026-05-19T13:38:35+00:00

My rails 3 app runs in the background of a Apache/mod_proxy server. In the

  • 0

My rails 3 app runs in the background of a Apache/mod_proxy server.

In the rails app exists a mandatory prefix :site_pin

In Apache the i have the following to abstract my prefix:

ServerName example.com

ProxyRequests Off
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass / http://localhost:3000/site/example/
ProxyPassReverse / http://localhost:3000/site/example/

<Location />
    Order allow,deny
    Allow from all
</Location>

In my my routes.rb i have the following:

resources :products

#RESTful fix
match 'site/:site_pin/:controller/', :action => 'index', :via => [:get]
match 'site/:site_pin/:controller/new', :action => 'new', :via => [:get]
match 'site/:site_pin/:controller/', :action => 'create', :via => [:post]
match 'site/:site_pin/:controller/:id', :action => 'show', :via => [:get]
match 'site/:site_pin/:controller/:id/edit', :action => 'edit', :via => [:get]
match 'site/:site_pin/:controller/:id', :action => 'update', :via => [:put]
match 'site/:site_pin/:controller/:id', :action => 'destroy', :via => [:delete]

Everything works fine in this way, but anyone has a better solution for remove this fix and make the routes.rb more clean?

  • 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-19T13:38:35+00:00Added an answer on May 19, 2026 at 1:38 pm

    scope would be very effective for this. Replace what you posted above in your routes.rb with:

    scope 'site/:site_pin' do
      resources :products
    end
    

    Now, run rake:routes in and you should see the following output:

        products GET    /site/:site_pin/products(.:format)             {:controller=>"products", :action=>"index"}
                 POST   /site/:site_pin/products(.:format)             {:controller=>"products", :action=>"create"}
     new_product GET    /site/:site_pin/products/new(.:format)         {:controller=>"products", :action=>"new"}
    edit_product GET    /site/:site_pin/products/:id/edit(.:format)    {:controller=>"products", :action=>"edit"}
         product GET    /site/:site_pin/products/:id(.:format)         {:controller=>"products", :action=>"show"}
                 PUT    /site/:site_pin/products/:id(.:format)         {:controller=>"products", :action=>"update"}
                 DELETE /site/:site_pin/products/:id(.:format)         {:controller=>"products", :action=>"destroy"}
    

    :site_pin will be available as params[:site_pin].

    Naturally, you’ll be able to add other resources and routes into the scope block; all of which will be prefixed with site/:site_pin.

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

Sidebar

Related Questions

I have a Rails app installed on a Slicehost server running Apache 2 and
I have a rails app that I'm moving to another server and I figure
In my Rails app, I have a Runs model, a Timesheets model, and an
I have few variables which are used system-wide in my rails app. It runs
I have started developing a new Rails app on my server using RVM, Rails
I'm building an Android app that runs off of a rails server. At first,
I have a Rails app that runs inside of Fabebook as an iframe. I
In our Rails app that runs in Facebook canvas, we have a workflow where
I have a rails 3 app (which I upgraded). It runs on passenger and
Our rails app runs on a ubuntu 10.04 server with sqlite3 database. How can

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.