htaccess not recognising non-Rails components

Posted on 2008-10-09
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"


# 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') 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


# 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

Question by:corebiz

Accepted Solution

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.
LVL 14

Expert Comment

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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:…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now