Solved

htaccess not recognising non-Rails components

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ruby on Rails - Installing ldap for Ruby on Rails 3 408
Ruby on Rails & iOS International Classes Recommendations 2 401
finding text after / 15 256
ECMAScript VS Ruby 3 394
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…
Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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