# Multiple rails apps to appear as one app

**URL:** <https://www.ruby-forum.com/t/multiple-rails-apps-to-appear-as-one-app/50220>\
**Category:** Rails\
**Created:** [December 14, 2005, 10:20am UTC](https://www.ruby-forum.com/t/multiple-rails-apps-to-appear-as-one-app/50220 "2005-12-14T10:20:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jo\_Vermeulen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@Jo\_Vermeulen](https://www.ruby-forum.com/u/Jo_Vermeulen)\
**Post date:** [December 14, 2005, 10:20am UTC](https://www.ruby-forum.com/t/multiple-rails-apps-to-appear-as-one-app/50220/1 "2005-12-14T10:20:08Z")

</div>

Hello everyone,

I have a problem concerning two rails apps, which I can’t seem to solve.  
I already tried the Ruby On Rails IRC channel. I also started a thread  
at the Site5 forums:

[http://forums.site5.com/showthread.php?t=6682](http://forums.site5.com/showthread.php?t=6682)

As is described in  
[http://wiki.rubyonrails.com/rails/pages/HowtoDeployMoreThanOneRailsAppOnOneMachine](http://wiki.rubyonrails.com/rails/pages/HowtoDeployMoreThanOneRailsAppOnOneMachine)  
, I would like two separate Rails applications to appear to the visitor  
as if they were one combined application.

I am in the process of moving my website over to a Site5 hosted domain (  
[http://jozilla.be/](http://jozilla.be/)). I wanted to redesign my homepage with Rails, while  
also running a Typo blog.

Ok, let’s get to the point. I have a two directories in my homedir,  
namely “typo” and “homepage”. Both are Rails applications. Then I have a  
“public\_html” directory, which has two symlinks “homepage” and “blog”,  
which point respectively to “~/homepage/public” and “~/typo/public”.

Both these applications work fine. I can visit my homepage by going to  
[http://jozilla.be/homepage/](http://jozilla.be/homepage/) and I can go to my blog by typing in  
[http://jozilla.be/blog/](http://jozilla.be/blog/) .

But what I really want is [http://jozilla.be/](http://jozilla.be/) serving up the homepage  
Rails app, while [http://jozilla.be/blog/](http://jozilla.be/blog/) goes to the Typo blog. Ok,  
you’ll say, just use a RewriteRule to rewrite [http://jozilla.be/](http://jozilla.be/) to  
[http://jozilla.be/homepage/](http://jozilla.be/homepage/) (Site5 is running Apache btw).

But that’s not what I want. I _never_ even want to see “homepage” in the  
URL. So [http://jozilla.be/](http://jozilla.be/) should serve [http://jozilla.be/homepage/](http://jozilla.be/homepage/),  
[http://jozilla.be/links](http://jozilla.be/links) should serve [http://jozilla.be/homepage/links](http://jozilla.be/homepage/links),  
etc without ever redirecting to that particular URL.

Well, you’ll say, even that is solvable by using RewriteRule’s. Indeed  
it is. But Rails still thinks it’s living in the homepage subdirectory.  
So if I click on a link such as \<%= link\_to “Links”, :controller =\>  
“links” %\>, the visitor is still pointed at  
[http://jozilla.be/homepage/links](http://jozilla.be/homepage/links) instead of [http://jozilla.be/links](http://jozilla.be/links)!

I thought maybe Apache’s Alias directive could solve this (“Alias /blog  
/path/to/blog” and “Alias / /path/to/homepage”). However aliases can  
only be defined in the server config, which is out of my control.

Is there a way to handle my problem using Routing?

The only way I can think of to make it work is having two separate  
document roots for the application, such as [http://jozilla.be/](http://jozilla.be/) having  
“homepage” as it’s document root, and [http://blog.jozilla.be/](http://blog.jozilla.be/) having  
“blog” as it’s document root. But that’s not really one integrated  
website anymore.

Maybe I am still in the PHP mindset (a website is made of a collection  
of script files, which can be placed anywhere), but it looks like a  
shortcoming of rails if I can’t present two separate applications as one  
website to the visitor.

I hope you guys can help me out! Thanks in advance!

Best regards,

–  
Jo Vermeulen

---

<div class="post-metadata">

**Author:** ![Jo\_Vermeulen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@Jo\_Vermeulen](https://www.ruby-forum.com/u/Jo_Vermeulen)\
**Post date:** [December 14, 2005, 2:26pm UTC](https://www.ruby-forum.com/t/multiple-rails-apps-to-appear-as-one-app/50220/2 "2005-12-14T14:26:54Z")

</div>

Jo Vermeulen wrote:

> Hello everyone,
> 
> I have a problem concerning two rails apps, which I can’t seem to solve.  
> I already tried the Ruby On Rails IRC channel. I also started a thread  
> at the Site5 forums:

Well apparantly this has been an open issue for a while now:

[http://wiki.rubyonrails.com/rails/pages/HowToMergeTwoOrMoreRailsApplications](http://wiki.rubyonrails.com/rails/pages/HowToMergeTwoOrMoreRailsApplications)

I guess that means nobody really knows how to fix it ☹

Best regards,

– Jo Vermeulen

---

<div class="post-metadata">

**Author:** ![Jo\_Vermeulen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@Jo\_Vermeulen](https://www.ruby-forum.com/u/Jo_Vermeulen)\
**Post date:** [December 15, 2005, 7:31pm UTC](https://www.ruby-forum.com/t/multiple-rails-apps-to-appear-as-one-app/50220/3 "2005-12-15T19:31:21Z")

</div>

On 12/14/05, Jo Vermeulen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

You can set the relative url\_root…

ActionController::AbstractRequest.relative\_url\_root = “/my\_app\_root”

Does that help?  
pth

---

<div class="post-metadata">

**Author:** ![Jo\_Vermeulen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@Jo\_Vermeulen](https://www.ruby-forum.com/u/Jo_Vermeulen)\
**Post date:** [December 15, 2005, 8:38pm UTC](https://www.ruby-forum.com/t/multiple-rails-apps-to-appear-as-one-app/50220/4 "2005-12-15T20:38:30Z")

</div>

Patrick H. wrote:

> On 12/14/05, Jo Vermeulen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> You can set the relative url\_root…
> 
> ActionController::AbstractRequest.relative\_url\_root = “/my\_app\_root”
> 
> Does that help?  
> pth

No I already tried that.

Well in fact, maybe what I’m doing isn’t quite clean. So I have fixed it  
by creating a separate document root for my blog. My homepage is now  
located at the main domain, and my blog at a blog subdomain.

Thanks for your answer!

– Jo
