How to add MIME type and associate it with .rhtml extension

For version eruby-1.0.5:

SSH into your box.

mkdir ~/eruby
cd ~/eruby
wget
http://www.modruby.net/archive/eruby-1.0.5.tar.gz
tar -xzf eruby-1.0.5.tar.gz
cd eruby-1.0.5
./configure.rb
make
cp eruby ~/public_html/cgi-bin/eruby
cd ~/public_html/cgi-bin
chmod 755 eruby

then add these 2 lines to your .htaccess

AddType application/x-httpd-eruby .rhtml
Action application/x-httpd-eruby /cgi-bin/eruby

Now .rhtml (embedded ruby files) will work. I also add the .rb/.rbx extensions to the AddType.

Example: (helloworld.rhtml)

<%
title = "eRuby test"
body = "hello world (from Ruby)"
%>
<html>
<head>
<title>
<%= title %>
</title>
</head>
<body>
<%= body %>
</body>
</html>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to set up Ruby on Rails

Using Ruby On Rails on Iwebhosting.com.my:This is intended to be a brief introduction to...

What is the path to Ruby?

The path to the Ruby interpretor is:/usr/bin/ruby

How do I install my own Gems?

1) Using File Manager in your cPanel make a copy of the .bashrc file in your root directory, name...

.htaccess File to Fix Ruby on Rails 404 Errors

Please create a .htaccess file inside the public folder with the following code: # General...

Errors when running 'Generate' in Ruby

This problem usually appears only after you have created your first application, generated the...