# Routing question

**URL:** <https://www.ruby-forum.com/t/routing-question/92374>\
**Category:** Rails\
**Created:** [April 18, 2007, 9:11pm UTC](https://www.ruby-forum.com/t/routing-question/92374 "2007-04-18T21:11:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [April 18, 2007, 9:11pm UTC](https://www.ruby-forum.com/t/routing-question/92374/1 "2007-04-18T21:11:23Z")

</div>

I am trying to add a WordPress blog to my rails app. I have installed  
WP in rails/myapp/public/blog with the hope that the actual URL will  
look like [www.mydomain.com/blog](http://www.mydomain.com/blog). How do I tell rails to let WP handle  
requests for everything within that blog directory or otherwise get this  
to work?

Thanks in advance for the assistance.

Bryan

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [April 18, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/routing-question/92374/2 "2007-04-18T21:56:57Z")

</div>

> I am trying to add a WordPress blog to my rails app. I have installed  
> WP in rails/myapp/public/blog with the hope that the actual URL will  
> look like [www.mydomain.com/blog](http://www.mydomain.com/blog). How do I tell rails to let WP handle  
> requests for everything within that blog directory or otherwise get this  
> to work?

Configure your web server to pass anything under /blog “around” rails  
and  
handle it via normal PHP methods.

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [April 19, 2007, 3:50am UTC](https://www.ruby-forum.com/t/routing-question/92374/3 "2007-04-19T03:50:33Z")

</div>

Philip H. wrote:

> > I am trying to add a WordPress blog to my rails app. I have installed  
> > WP in rails/myapp/public/blog with the hope that the actual URL will  
> > look like [www.mydomain.com/blog](http://www.mydomain.com/blog). How do I tell rails to let WP handle  
> > requests for everything within that blog directory or otherwise get this  
> > to work?
> 
> Configure your web server to pass anything under /blog “around” rails  
> and  
> handle it via normal PHP methods.

Philip,

Thanks for your help. Sorry to be such a novice but could you (or  
anyone else) give me a little more info on how to do this in Apache.

Thanks again,  
Bryan

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [April 20, 2007, 4:20am UTC](https://www.ruby-forum.com/t/routing-question/92374/4 "2007-04-20T04:20:11Z")

</div>

> Hi, I have a similar issue and have solved this by putting the following  
> line in my .htaccess file in my rails app directory:-
> 
> RewriteCond %{REQUEST\_URI} ^/osc.\*  
> RewriteRule .\* - [L]
> 
> This tells rails to leave the /osc subdirectory alone.
> 
> However, I have discovered a problem with this that I would really like  
> to solve. The application in my subdirectory /osc is OSCommerce  
> shopping cart. This has an admin page which is restricted using a  
> .htaccess file and Basic Auth.
> 
> When I go to /osc/admin the request is left alone by rails due to the  
> Rewrite lines above. However, when the .htaccess kicks in and requests  
> my username and password using the 403 Authorize Rails grabs the 403  
> Authorize and I get a 404 not found. If I turn rails off my OScommerce  
> Admin page works ok so I am fairly sure that rails is grabbing the 403  
> request despite the Rewrite Rule.
> 
> So the above line might help you out but if anyone has an answer to how  
> I can solve this other issue I would love to hear from you.
> 
> Cheers,
> 
> G.

Thanks Graham, this worked. Note to anyone else reading this who might  
not know to do so, it only works when it is above “RewriteRule: On”. At  
least that’s how it was for me.

Thanks Philip and Graham for helping me get this worked out.

Bryan

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [April 19, 2007, 4:32pm UTC](https://www.ruby-forum.com/t/routing-question/92374/5 "2007-04-19T16:32:26Z")

</div>

Guest wrote:

> Philip H. wrote:
> 
> > > I am trying to add a WordPress blog to my rails app. I have installed  
> > > WP in rails/myapp/public/blog with the hope that the actual URL will  
> > > look like [www.mydomain.com/blog](http://www.mydomain.com/blog). How do I tell rails to let WP handle  
> > > requests for everything within that blog directory or otherwise get this  
> > > to work?
> > 
> > Configure your web server to pass anything under /blog “around” rails  
> > and  
> > handle it via normal PHP methods.
> 
> Philip,
> 
> Thanks for your help. Sorry to be such a novice but could you (or  
> anyone else) give me a little more info on how to do this in Apache.
> 
> Thanks again,  
> Bryan

Hi, I have a similar issue and have solved this by putting the following  
line in my .htaccess file in my rails app directory:-

RewriteCond %{REQUEST\_URI} ^/osc.\*  
RewriteRule .\* - [L]

This tells rails to leave the /osc subdirectory alone.

However, I have discovered a problem with this that I would really like  
to solve. The application in my subdirectory /osc is OSCommerce  
shopping cart. This has an admin page which is restricted using a  
.htaccess file and Basic Auth.

When I go to /osc/admin the request is left alone by rails due to the  
Rewrite lines above. However, when the .htaccess kicks in and requests  
my username and password using the 403 Authorize Rails grabs the 403  
Authorize and I get a 404 not found. If I turn rails off my OScommerce  
Admin page works ok so I am fairly sure that rails is grabbing the 403  
request despite the Rewrite Rule.

So the above line might help you out but if anyone has an answer to how  
I can solve this other issue I would love to hear from you.

Cheers,

G.
