Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (24 sloc) 1.24 kB
#adapted from http://andrewho.co.uk/weblog/clean-urls-on-jekyll-apache
#Options +FollowSymLinks
#The first step is to turn on mod_rewrite:
RewriteEngine On
#Create 404.html and let .htaccess know about it:
ErrorDocument 404 /404.html
#All resources should be accessed via the main domain name, not a subdomain:
RewriteCond %{HTTP_HOST} ^[^\.]+\.ontologicalwarfare\.com$ [NC]
RewriteRule ^(.*)$ http://ontologicalwarfare.com/$1 [R=301,L]
#Remove trailing slashes (note that mod_dir fiddles around with them so disable that behaviour here too):
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
Options -Indexes
DirectorySlash Off
#Hide the *.html files by redirecting all requests for foo.html to foo:
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /.+\.html\ HTTP
RewriteRule ^(.+)\.html$ http://%{HTTP_HOST}/$1 [R=301,L]
#If the client requests /foo but that doesn't exist, then try /foo.html:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^.+$ %{REQUEST_FILENAME}.html [L]
#Next, If the client requests /foo but that doesn't exist, then try /foo/index.html:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html -f
RewriteRule ^.+$ %{REQUEST_FILENAME}/index.html [L]
Jump to Line
Something went wrong with that request. Please try again.