# Rails and php mixed

**URL:** <https://www.ruby-forum.com/t/rails-and-php-mixed/182432>\
**Category:** Rails\
**Created:** [January 27, 2010, 11:53pm UTC](https://www.ruby-forum.com/t/rails-and-php-mixed/182432 "2010-01-27T23:53:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fRAnKEnSTEin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/0ea827/32.png) [@fRAnKEnSTEin](https://www.ruby-forum.com/u/fRAnKEnSTEin)\
**Post date:** [January 27, 2010, 11:53pm UTC](https://www.ruby-forum.com/t/rails-and-php-mixed/182432/1 "2010-01-27T23:53:51Z")

</div>

Hi,

I have a rails site hosted in a mediatemple DV plan. I am not using  
mongrels as web server, instead i am using passenger and it works  
great.

Now what i want to do, is to host a PHP legacy site inside my public’s  
rails folder, so any user can acces the rails site using for example  
[www.misite.com](http://www.misite.com) and acces the PHP site using [www.misite.com/phpsite/](http://www.misite.com/phpsite/)

I have search for this on the internet and try differents ways but  
without any luck… any idea about how can i do this?

Regrads

Note: Just in case, each domain is located in a vhost directory  
(mediatemple Dv default config)

---

<div class="post-metadata">

**Author:** ![fRAnKEnSTEin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/0ea827/32.png) [@fRAnKEnSTEin](https://www.ruby-forum.com/u/fRAnKEnSTEin)\
**Post date:** [January 28, 2010, 12:11am UTC](https://www.ruby-forum.com/t/rails-and-php-mixed/182432/2 "2010-01-28T00:11:13Z")

</div>

fRAnKEnSTEin wrote:

> Hi,
> 
> I have a rails site hosted in a mediatemple DV plan. I am not using  
> mongrels as web server, instead i am using passenger and it works  
> great.
> 
> Now what i want to do, is to host a PHP legacy site inside my public’s  
> rails folder, so any user can acces the rails site using for example  
> [www.misite.com](http://www.misite.com) and acces the PHP site using [misite.com](http://www.misite.com/phpsite/)

Don’t do it that way. Put the Rails and PHP sites in separate  
directories on the server. Set up a separate virtual host (say,  
[phpsite.misite.com](http://phpsite.misite.com) ) for the PHP site (you can do this in your Web  
server configuration).

> I have search for this on the internet and try differents ways but  
> without any luck… any idea about how can i do this?
> 
> Regrads
> 
> Note: Just in case, each domain is located in a vhost directory  
> (mediatemple Dv default config)

Perfect, then…you’ve already got your vhost. If you really want URLs  
of the form [www.misite.com/phpsite](http://www.misite.com/phpsite), then set up a redirect.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![fRAnKEnSTEin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/0ea827/32.png) [@fRAnKEnSTEin](https://www.ruby-forum.com/u/fRAnKEnSTEin)\
**Post date:** [January 28, 2010, 12:24am UTC](https://www.ruby-forum.com/t/rails-and-php-mixed/182432/3 "2010-01-28T00:24:17Z")

</div>

> Perfect, then…you’ve already got your vhost. If you really want URLs  
> of the [formwww.misite.com/phpsite](http://formwww.misite.com/phpsite), then set up a redirect.

Hi,

ok, but that where i have to put that redirect sentence? i mean,  
in .htaccess file inside public rails app, or inside php site folder,  
or in my [www.site.com](http://www.site.com) vhost file, or in httpd.conf file?

i am bit confused here.

Cheers

---

<div class="post-metadata">

**Author:** ![fRAnKEnSTEin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/0ea827/32.png) [@fRAnKEnSTEin](https://www.ruby-forum.com/u/fRAnKEnSTEin)\
**Post date:** [January 28, 2010, 12:31am UTC](https://www.ruby-forum.com/t/rails-and-php-mixed/182432/4 "2010-01-28T00:31:54Z")

</div>

> Perfect, then…you’ve already got your vhost. If you really want URLs  
> of the form [www.misite.com/phpsite](http://www.misite.com/phpsite), then set up a redirect.

Hi,

yes i need to use that URL form([www.misite.com/phpsite](http://www.misite.com/phpsite) and  
[ww.misite.com](http://ww.misite.com)), but where i have put that redirect sentence? i mean,  
in .htaccess file inside my rails app’s public folder?, or inside php  
app folder?, â€¨or in my domain vhost file, or in httpd.conf file?

I have tryed to put some “rewrite” rules in all that files i have just  
sayed(and restart apeche), but none of them worked. Can you tell me  
how that redirect could be donde and where i have to put it?

regards

---

<div class="post-metadata">

**Author:** ![fRAnKEnSTEin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/0ea827/32.png) [@fRAnKEnSTEin](https://www.ruby-forum.com/u/fRAnKEnSTEin)\
**Post date:** [January 28, 2010, 12:28am UTC](https://www.ruby-forum.com/t/rails-and-php-mixed/182432/5 "2010-01-28T00:28:19Z")

</div>

fRAnKEnSTEin wrote:

> > Perfect, then…you’ve already got your vhost. ï¿½If you really want URLs  
> > of the [formwww.misite.com/phpsite](http://formwww.misite.com/phpsite), then set up a redirect.
> 
> Hi,
> 
> ok, but that where i have to put that redirect sentence? i mean,  
> in .htaccess file inside public rails app, or inside php site folder,  
> or in my [www.site.com](http://www.site.com) vhost file, or in httpd.conf file?

Well, you’re redirecting _from_ [www.misite.com/phpsite](http://www.misite.com/phpsite). That means you  
need to put the redirect in the part of the Web server that’s processing  
that URL.

> i am bit confused here.

What’s confusing about it? All that a redirect does is intercept a  
request and send it somewhere else.

> Cheers

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
