# Problem with images/stylesheets between windows and unix

**URL:** <https://www.ruby-forum.com/t/problem-with-images-stylesheets-between-windows-and-unix/73402>\
**Category:** Rails\
**Created:** [October 24, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/problem-with-images-stylesheets-between-windows-and-unix/73402 "2006-10-24T13:55:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 24, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/problem-with-images-stylesheets-between-windows-and-unix/73402/1 "2006-10-24T13:55:09Z")

</div>

Hi,

I’m finding my image and stylesheets are resolving fine on  
windows/webbrick,  
but not on unix (Dreamhost). I can’t navigate to them on dreamhost and  
I  
get a “File not Found - Change this error message for pages not found  
in  
public/404.html”

One difference is that on dreamhost (fastcgi) I do use Capistrano so my  
rails application is under /current/, but I have mapped this in the  
dreamhost domain setup tool.

Can anyone spot if something is wrong in my .htaccess file below? Is  
the  
idea that static files (e.g. images/stylesheets) are supposed to be  
covered  
off in .htaccess with no entries required for them in routes.rb?

===========================================  
AddHandler fastcgi-script .fcgi  
AddHandler cgi-script .cgi  
Options +FollowSymLinks +ExecCGI

RewriteEngine On

RewriteCond %{DOCUMENT\_ROOT}/system/maintenance.html -f  
RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
RewriteRule ^.\*$ /system/maintenance.html [L]

RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f

RewriteCond %{REQUEST\_URI} ^/stylesheets.\*  
RewriteRule .\* - [L]

RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

# ErrorDocument 500 “

## Application error
Rails application failed to  
start properly”

Tks

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 24, 2006, 2:23pm UTC](https://www.ruby-forum.com/t/problem-with-images-stylesheets-between-windows-and-unix/73402/2 "2006-10-24T14:23:25Z")

</div>

Your domain points to your public/ directory right? I’m sure it does but  
just to check…

I don’t think I use the rewrite rules at all, maybe that slows it down a  
bit as static requests do go through rails. But here is the complete  
.htaccess which resides in the public/ directory( I haven’t mastered  
Apache config so I’ve barely touched this file ):

AddHandler fastcgi-script .fcgi  
Options +FollowSymLinks +ExecCGI

RewriteEngine On  
RewriteBase /

RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 “

## Application error
Rails application failed to  
start properly”

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 24, 2006, 10:11pm UTC](https://www.ruby-forum.com/t/problem-with-images-stylesheets-between-windows-and-unix/73402/3 "2006-10-24T22:11:59Z")

</div>

My domain does point to current/public yep…actually I am getting a  
routing  
error (recognition railed) when navigating directly to a stylesheet so  
this  
probably indicates I guess that the rewrite rules aren’t working.

(a) Can anyone spot an issue with the .htaccess file below, and in  
particular the following portion of it?  
RewriteCond %{REQUEST\_URI} ^/stylesheets.\*  
RewriteRule .\* - [L]

(b) If I update .htaccess is there anything I need to do to make it take  
effect? (again I’m on Dreamhost [fastcgi])

Tks

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 24, 2006, 10:18pm UTC](https://www.ruby-forum.com/t/problem-with-images-stylesheets-between-windows-and-unix/73402/4 "2006-10-24T22:18:02Z")

</div>

PS. Sorry, can I add question c too below (refer previous post re (a)  
and  
(b) questiosn):

© Given that my direct request for one of the image files is making it  
to  
rails (as I get a ActionController::RoutingError (Recognition failed for  
“/images/arrow\_right.gif”), and that this request works fine locally on  
webbrick but not at dreamhost (e.g.  
http:///images/arrow\_right.gif)  
then:

- should it be the case that the rails routes.rb and the routing method  
should match up a direct request without having the need for an entry in  
routes.rb to cover this. That is should I need to put something into  
routes.rb to cover off the ability to pick up static type files from  
/public?

- any other ideas here?
