# Php and rails on same domain

**URL:** <https://www.ruby-forum.com/t/php-and-rails-on-same-domain/146914>\
**Category:** Deployment\
**Created:** [August 26, 2008, 7:07pm UTC](https://www.ruby-forum.com/t/php-and-rails-on-same-domain/146914 "2008-08-26T19:07:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yankees26](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/eb9ed0/32.png) [@yankees26](https://www.ruby-forum.com/u/yankees26)\
**Post date:** [August 26, 2008, 7:07pm UTC](https://www.ruby-forum.com/t/php-and-rails-on-same-domain/146914/1 "2008-08-26T19:07:48Z")

</div>

hi.  
I have a php website running on an apache webserver.  
I wrote an extension for this application in rails.  
For deployment I want to use passenger(mod\_rails).  
At the moment the php application runs on a virtual host on port 80 and  
the rails app on port 3000.  
In production both apps should be available under the same domain name.

For example  
[http://www.domain.com/](http://www.domain.com/)\* → php  
[http://www.domain.com/bar](http://www.domain.com/bar) → rails  
[http://www.domain.com/foo](http://www.domain.com/foo) → rails

Can anyone give me hint how I can solve the problem.

thanks  
michael

---

<div class="post-metadata">

**Author:** ![yankees26](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/eb9ed0/32.png) [@yankees26](https://www.ruby-forum.com/u/yankees26)\
**Post date:** [August 26, 2008, 9:36pm UTC](https://www.ruby-forum.com/t/php-and-rails-on-same-domain/146914/2 "2008-08-26T21:36:08Z")

</div>

On 26.8.2008, at 20.07, Joao S. wrote:

> For example  
> [http://www.domain.com/](http://www.domain.com/)\* → php  
> [http://www.domain.com/bar](http://www.domain.com/bar) → rails  
> [http://www.domain.com/foo](http://www.domain.com/foo) → rails
> 
> Can anyone give me hint how I can solve the problem.

You can use ProxyPass and ProxyPassReverse for that:  
[http://www.benlog.org/2007/2/17/deploy-your-rails-app-in-a-subdirectory-with-apache-and-mongrel](http://www.benlog.org/2007/2/17/deploy-your-rails-app-in-a-subdirectory-with-apache-and-mongrel)

With Passenger I think it works automatically using RailsBaseURI (see  
[Phusion Passenger users guide index](http://www.modrails.com/documentation/Users%20guide.html))  
.

//jarkko

–  
Jarkko L.

> **[jlaine.net](https://jlaine.net/)**
>
> Your freedom to carry a gun messes with my freedom to walk around without fear. Your freedom to “stand your ground” with force is at odds with my …

> **[Home](https://dotherightthing.com/)**
>
> do the right thing

[http://www.railsecommerce.com](http://www.railsecommerce.com)  
[http://odesign.fi](http://odesign.fi)
