SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Routes.rb Exceptions/Exclusions

    I'm a complete n00b to Rails and am with MediaTemple. I activated my Rails container on my site root and as a result I can no longer get to my blog, which sits at /blog/

    Is there any way that I can add an exclusion for /blog/ in the routes.rb file so it doesn't process that /blog/ as part of the application and instead drops out ... or is that not how Ruby on Rails works?

    The thing is, I realised my error by putting the app on site root but when I deleted the app and even deactivated the container I got a 503 Error when accessing on site root or /blog/... and the MediaTemple phone lines have been down all night.

    Any suggestions will be gratefully appreciated.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depends. I don't know how MediaTemple is setting up their rails "containers." If it's Phusion Passenger-based, there may be some hope, because you can configure Passenger to ignore some directories. If they're setting it up to run under Mongrel, proceed to "Future reference."

    I wonder if, since despite deleting the app you're getting errors, the .htaccess file is still trying to map your requests to a rails app. Have a look there and see if there's some rewrite rules there that are getting you.

    Future reference: It's generally safer, especially for new experimenters, to install rails apps in a dedicated subdomain rather than their main work areas. Rails is meant to be an app, not just a few pages in a corner of a website, so it can get tricky trying to slip in chunks of other code outside of the "public" directory.

    Which does give rise to an idea that *may* be useful: move your blog to /public/blog in the rails app and see what happens. I've never tried running anything like that out of the public area, so I have no idea how or even if it'll work, but if I absolutely needed rails and a non-rails blog to co-exist inn the same domain, it's one method I'd be sure to try.

    Of course, a basic blog is trivial in Rails, so you could always decide to convert your blog to Rails at the same time, and your problem will go away. ;{>}

  3. #3
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. That seems to have worked... almost.

    I can see my blog on /blog/index.php, but not when I just do /blog/ or click on any of the permalinks.

    I think that's going to be something to do with the .htaccess file as you were mentioning so I will look there first.

  4. #4
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup. A simple .htaccess file uploaded to /blog/ has done the trick.

    The file reads:

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    # If requested resource does not exist as a file
    RewriteCond %{REQUEST_FILENAME} !-f
    # and does not end with a period followed by a filetype
    RewriteCond %{REQUEST_URI} !..+$
    # and does not end with a slash
    RewriteCond %{REQUEST_URI} !/$
    # then add a trailing slash and redirect
    RewriteRule (.*) $1/ [R=301,L]
    </IfModule>
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Now when a visitor goes to my homepage they get RoR, but when they go to /blog/ they get WordPress

    Thanks for your guidance Arlen. It is very much appreciated.

  5. #5
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad to be of help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •