# Mod\_ruby and Apache ForceType

**URL:** https://rubytalk.org/t/mod-ruby-and-apache-forcetype/12247
**Category:** ruby-talk
**Created:** [22 June 2004 11:28 UTC](https://rubytalk.org/t/mod-ruby-and-apache-forcetype/12247 "2004-06-22T11:28:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![George\_Moschovitis1](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@George\_Moschovitis1](https://rubytalk.org/u/George_Moschovitis1)
#### Post date: [22 June 2004 11:28 UTC](https://rubytalk.org/t/mod-ruby-and-apache-forcetype/12247/1 "2004-06-22T11:28:12Z")

</div>

Hello everyone,

I am trying to use the ForceType directive of apache  
to get more readable urls, like this php based example:

\<Files \*\>  
ForceType application/x-httpd-php  
\</Files\>

Does anyone know what is the equivalent of  
application/x-httpd-php for mod\_ruby?

I tried the following but failed:

AddType application/x-httpd-ruby .sx  
AddHandler ruby-object .sx  
\<Files \*\>  
ForceType application/x-httpd-ruby  
\</Files\>

Any help will be really appreciated!

George Moschovitis

---

<div class="post-metadata">

### Author: ![Carl\_Youngblood1](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@Carl\_Youngblood1](https://rubytalk.org/u/Carl_Youngblood1)
#### Post date: [22 June 2004 18:06 UTC](https://rubytalk.org/t/mod-ruby-and-apache-forcetype/12247/2 "2004-06-22T18:06:42Z")

</div>

One other approach that I've used is to use mod\_rewrite to cause some  
scripts to be interpreted as ruby scripts. In this case I am causing  
certain URLS to be transparently redirected to a fastcgi script that  
happens to be a ruby script:

\<IfModule mod\_rewrite.c\>  
RewriteEngine on  
RewriteLog logs/rewrite\_log  
RewriteLogLevel 0

# don't use controller to process requests for static files  
RewriteCond %{REQUEST\_URI} .\*\.(gif|jpg|png|css|js)$  
RewriteRule .\* - [L]

# send all other requests into the controller ruby script  
RewriteRule ^.\*$ /controller.fcgi [L,T=fastcgi-script]  
\</IfModule\>

> **···**
>
> On Tue, 22 Jun 2004 20:28:12 +0900, George Moschovitis \<gm@navel.gr\> wrote:
> 
> > Hello everyone,
> > 
> > I am trying to use the ForceType directive of apache  
> > to get more readable urls, like this php based example:
> > 
> > \<Files \*\>  
> > ForceType application/x-httpd-php  
> > \</Files\>
> > 
> > Does anyone know what is the equivalent of  
> > application/x-httpd-php for mod\_ruby?
> > 
> > I tried the following but failed:
> > 
> > AddType application/x-httpd-ruby .sx  
> > AddHandler ruby-object .sx  
> > \<Files \*\>  
> > ForceType application/x-httpd-ruby  
> > \</Files\>
> > 
> > Any help will be really appreciated!
> > 
> > George Moschovitis

---

<div class="post-metadata">

### Author: ![Dick\_Davies1](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@Dick\_Davies1](https://rubytalk.org/u/Dick_Davies1)
#### Post date: [23 June 2004 08:42 UTC](https://rubytalk.org/t/mod-ruby-and-apache-forcetype/12247/3 "2004-06-23T08:42:45Z")

</div>

Can't answer directly , but isn't this the same as

\<Files \*\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetHandler ruby-object  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RubyHandler Apache::ERubyRun.instance  
\</Files\>

(for eruby)

or  
\<Files \*\>  
&nbsp;&nbsp;&nbsp;&nbsp;Options +ExecCGI  
&nbsp;&nbsp;&nbsp;&nbsp;SetHandler ruby-object  
&nbsp;&nbsp;&nbsp;&nbsp;RubyHandler Apache::RubyRun.instance  
\</Files\>

(for ruby cgi type scripts)

I'd replace the \<Files\> above with a \<FilesMatch\> to  
exclude images etc.

\* George Moschovitis \<gm@navel.gr\> [0631 12:31]:

> **···**
>
> > Hello everyone,
> > 
> > I am trying to use the ForceType directive of apache  
> > to get more readable urls, like this php based example:
> > 
> > \<Files \*\>  
> > ForceType application/x-httpd-php  
> > \</Files\>
> > 
> > Does anyone know what is the equivalent of  
> > application/x-httpd-php for mod\_ruby?
> > 
> > I tried the following but failed:
> > 
> > AddType application/x-httpd-ruby .sx  
> > AddHandler ruby-object .sx  
> > \<Files \*\>  
> > ForceType application/x-httpd-ruby  
> > \</Files\>
> > 
> > Any help will be really appreciated!
> > 
> > George Moschovitis
> 
> --  
> Mosher's Law of Software Engineering:  
> &nbsp;&nbsp;Don't worry if it doesn't work right. If everything did, you'd  
> be out of a job.  
> Rasputin :: Jack of All Trades - Master of Nuns
