SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: Routes.rb Exceptions/Exclusions
-
Nov 8, 2008, 21:27 #1
- 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.
-
Nov 9, 2008, 00:26 #2
- 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. ;{>}
-
Nov 9, 2008, 05:28 #3
- 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.
-
Nov 9, 2008, 05:47 #4
- 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
Thanks for your guidance Arlen. It is very much appreciated.
-
Nov 11, 2008, 22:32 #5
- Join Date
- Feb 2007
- Posts
- 270
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Glad to be of help.
Bookmarks