Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

htaccess not recognising non-Rails components

Posted on 2008-10-09
2
Medium Priority
?
795 Views
Last Modified: 2013-11-13
I've been having trouble with my site after Dreamhost upgraded Rails to 2.1.1.  In the end I just froze my application to Rails 1.2.5.

I'm now having a problem that my non-Rails components (like wordpress/phpbb/mediawiki/mantis) are throwing a page not found problem.  If I delete the environment.rb file and restart the rails application, the reverse happens (can see these components, but rails doesn't run obviously).

The other strange thing is that my environment.rb file is set for production mode, but if I call script/about in my Putty console, it says I have the development version.  Perhaps these problems are related?

.htaccess and environment.rb below...
.htaccess file:
 
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
 
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]
 
 
RewriteCond %{REQUEST_URI} ^/blog.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/habanero/forum.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/habanero/wiki.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/support/mantis.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
RewriteRule .* - [L]
 
# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On
 
# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp
 
 
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
 
# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html
 
# ErrorDocument 500 "Rails application failed to start properly"
ErrorDocument 500 /sitedown.html
# ErrorDocument "The Chillisoft website is is temporarily down"
 
 
 
 
environment.rb:
 
 
# Be sure to restart your web server when you modify this file.
 
# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
 ENV['RAILS_ENV'] ||= 'production'
 
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION
 
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
 
Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here
  
  # Skip frameworks you're not going to use (only works if using vendor/rails)
  # config.frameworks -= [ :action_web_service, :action_mailer ]
 
  # Only load the plugins named here, by default all plugins in vendor/plugins are loaded
  # config.plugins = %W( exception_notification ssl_requirement )
 
  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )
 
  # Force all environments to use the same logger level 
  # (by default production uses :info, the others :debug)
  # config.log_level = :debug
 
  # Use the database for sessions instead of the file system
  # (create the session table with 'rake db:sessions:create')
    config.action_controller.session_store = :active_record_store
 
  # Use SQL instead of Active Record's schema dumper when creating the test database.
  # This is necessary if your schema can't be completely dumped by the schema dumper, 
  # like if you have constraints or database-specific column types
  # config.active_record.schema_format = :sql
 
  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector
 
  # Make Active Record use UTC-base instead of local time
  # config.active_record.default_timezone = :utc
  
  # See Rails::Configuration for more options
end
 
# Add new inflection rules using the following format 
# (all these examples are active by default):
# Inflector.inflections do |inflect|
#   inflect.plural /^(ox)$/i, '\1en'
#   inflect.singular /^(ox)en/i, '\1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
# end
 
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile
 
# Include your application configuration below

Open in new window

0
Comment
Question by:corebiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
corebiz earned 0 total points
ID: 22676540
Never mind.  Ticking the option to use Passenger was the cause of the problem and I'm back to normal now.
0
 
LVL 14

Expert Comment

by:wesgarrison
ID: 22684298
"The other strange thing is that my environment.rb file is set for production mode, but if I call script/about in my Putty console, it says I have the development version."

Probably because you're not calling it with an environment and it defaults to production. Call it like:
ruby script/about RAILS_ENV=production
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question