summaryrefslogtreecommitdiff
path: root/public_html/index.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'public_html/index.cgi')
-rwxr-xr-xpublic_html/index.cgi7
1 files changed, 6 insertions, 1 deletions
diff --git a/public_html/index.cgi b/public_html/index.cgi
index 7d8a8b1..4480cd6 100755
--- a/public_html/index.cgi
+++ b/public_html/index.cgi
@@ -60,8 +60,13 @@ class ErubisHandler
filepath = basepath =~ /\A\/(~[-.\w]+)/ \
? File.join(File.expand_path($1), "public_html", $') \
: File.join(document_root, basepath)
- filepath.gsub!(/\.html\z/, '.rhtml') or # expected '*.html'
+ if filepath =~ /\.html\z/ # expected '*.html'
+ filepath.gsub!(/\.html\z/, '.rhtml')
+ elsif filepath[-1] == ?/ # directory index
+ filepath += 'index.rhtml'
+ else
raise HttpError.new(500, 'invalid .htaccess configuration.')
+ end
File.file?(filepath) or # file not found
raise HttpError.new(404, "#{basepath}: not found.")
basepath != env['SCRIPT_NAME'] or # can't access to index.cgi