0

I have a Ruby on Rails app with two sub-sites, www.example.com/site1 and www.example.com/site2. For demonstration purpose, we need to disable site2 and only show site1. So I made some redirects in my apache virtual host conf like this

Redirect 301 http://www.example.com/site2 http://www.example.com/site1
Redirect 301 http://www.example.com http://www.example.com/site1

to be sure to always redirect to site1. Now, it would be great, if we could kinda strip out the site1 from the url http://www.example.com/site1 so that it only shows http://www.example.com, but also can handle sub sites (e.g. the "original" site is http://www.example.com/site1/cat1 and it should be displayed as http://www.example.com/cat1).

  • Is this possible using apache's rewrite engine? And how?
  • I'm not sure if I have to change something inside my app, or is the request URL (that my router picks up) not modified by apache?
  • Another solution would be, to only show the domain in the users address bar. Is this possible, and how?
23tux
  • 101
  • 1
  • 4

1 Answers1

0

This sounds more like you should just change the DocumentRoot for www.example.com to the site1 directory instead of what it is now. That obviates the need for redirection in all three of your cited examples.

John
  • 8,920
  • 1
  • 28
  • 34
  • Nope, that won't work, because the underlying app is a Ruby on Rails application, which doesn't have any folder like structure, just a router. But we don't want to change anything on the app, because it's just for a one-time demonstration – 23tux Dec 26 '13 at 20:26