Skip to content

Instantly share code, notes, and snippets.

@andrewheiss
Created February 20, 2010 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewheiss/309958 to your computer and use it in GitHub Desktop.
Save andrewheiss/309958 to your computer and use it in GitHub Desktop.
RewriteEngine On
# Map http://www.andrewheiss.com to /jekyll.
RewriteRule ^$ /jekyll/ [L]
# Map http://www.andrewheiss.com/x to /jekyll/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/jekyll/
RewriteRule ^(.*)$ /jekyll/$1
# Add trailing slash to directories without them so DirectoryIndex works.
# This does not expose the internal URL.
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !/$
RewriteRule ^(.*)$ $1/
# Disable auto-adding slashes to directories without them, since this happens
# after mod_rewrite and exposes the rewritten internal URL, e.g. turning
# http://www.andrewheiss.com/about into http://www.andrewheiss.com/jekyll/about.
DirectorySlash off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment