solution to pretty urls (no .html extension)

28 views
Skip to first unread message

Zenon

unread,
Mar 15, 2010, 4:12:10 AM3/15/10
to Webby
Hello Webby folks!

I've written up my solution for the pretty url problem. It requires a
tiny little Webrick hack and a touch of .htaccess magic.

In detail:

http://skythink.com/doc/simple-web-development-with-webby

In brief:

(1) Have your "layouts/default.txt" set default rendering with:
extension: ""

(2) Let Webrick default to the text/html MIME type with this in your
lib directory:

require 'webrick'
class Webby::AutoBuilder::WebServer
alias_method :old_initialize, :initialize
def initialize
WEBrick::HTTPUtils::DefaultMimeTypes.store(nil, 'text/html')
old_initialize
end
end

(3) On your deployed server, tell Apache (via .htaccess) that any file
that doesn't contain a dot should be considered text/html:

RewriteEngine On
RewriteBase /

RewriteRule !\. - [T=text/html]


This works for me in my particular Ubuntu Linux environment. Not sure
if it will work for you, so please be careful!

Keep Webbying.

Reply all
Reply to author
Forward
0 new messages