# Ignore a route?

**URL:** <https://www.ruby-forum.com/t/ignore-a-route/114730>\
**Category:** Rails\
**Created:** [September 17, 2007, 1:24pm UTC](https://www.ruby-forum.com/t/ignore-a-route/114730 "2007-09-17T13:24:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@ahab](https://www.ruby-forum.com/u/ahab)\
**Post date:** [September 17, 2007, 1:24pm UTC](https://www.ruby-forum.com/t/ignore-a-route/114730/1 "2007-09-17T13:24:51Z")

</div>

Is it possible to have rails ignore a given route?

[http://mysite.com](http://mysite.com) # =\> This is my rails app  
[http://mysite.com/blog](http://mysite.com/blog) # =\> This is my wordpress blog

Can I map a route so that rails will ignore, or not handle, the blog  
request?

My 2 solutions are:

1. Move the app to a subdomain
2. Move the app into a subdrectory

One of these will work, but out of curiosity, the question stands.

---

<div class="post-metadata">

**Author:** ![ahab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@ahab](https://www.ruby-forum.com/u/ahab)\
**Post date:** [September 17, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/ignore-a-route/114730/2 "2007-09-17T13:25:10Z")

</div>

Exactly the question I had in mind. I have my site and blog running  
PHP and Wordpress. Only my site is being turned into RoR, blog will  
remain as it is. It’s important to maintain all links as it is. As is  
written on Hostgator support page:  
[http://forums.hostgator.com/showthread.php?t=13038](http://forums.hostgator.com/showthread.php?t=13038)  
you have to create the .htaccess file and do the routing from there:

RewriteEngine on  
RewriteCond %{REQUEST\_URI} !^/cpanel/.\*  
RewriteCond %{HTTP\_HOST} ^www.mydomain.com [OR]  
RewriteCond %{HTTP\_HOST} ^mydomain.com  
RewriteRule ^(.\*)$ /myapp/$1 [L,QSA]

I haven’t dealt with this before, but I am assuming something like

RewriteCond %{REQUEST\_URI} !^/blog/.\* as in RewriteCond %  
{REQUEST\_URI} !^/cpanel/.\* would work

I a yet to try it once ready. What do you think?

---

<div class="post-metadata">

**Author:** ![ahab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@ahab](https://www.ruby-forum.com/u/ahab)\
**Post date:** [September 25, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/ignore-a-route/114730/3 "2007-09-25T23:04:57Z")

</div>

> Is it possible to have rails ignore a given route?

Dunno, but by the time it’s gotten to Rails, even if Rails did ignore  
it,  
what would happen? My guess is Rails would return a 404. It’s too late  
to pass it back even if it knew how to do so.

> [http://mysite.com](http://mysite.com) # =\> This is my rails app  
> [http://mysite.com/blog](http://mysite.com/blog) # =\> This is my wordpress blog
> 
> Can I map a route so that rails will ignore, or not handle, the blog  
> request?
> 
> My 2 solutions are:
> 
> 1. Move the app to a subdomain

Probably the simplest as it completely isolates them, but not strictly  
necessary.

> 1. Move the app into a subdrectory

Doable. Configure your webserver (apache/litespeed/etc) to _not_ pass  
any  
requests matching “/blog” on to rails, but to handle them however it  
would  
handle it normally.

> One of these will work, but out of curiosity, the question stands.

Both will work as long as you configure it correctly.
