Skip to content

Instantly share code, notes, and snippets.

@niklas-heer
Created December 3, 2014 10:20
Show Gist options
  • Save niklas-heer/f1392572c9f0469f2133 to your computer and use it in GitHub Desktop.
Save niklas-heer/f1392572c9f0469f2133 to your computer and use it in GitHub Desktop.
.htaccess file for jekyll
# BEGIN Jekyll redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#this assumes you compiled your site to "/_site"
#Map http://www.example.com to /_site.
RewriteRule ^$ /_site/ [L]
#Map http://www.example.com/x to /_site/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/_site/
RewriteRule ^(.*)$ /_site/$1
# Add trailing slash to directories within jekyll
# This does not expose the internal URL.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^_site/(.*[^/])$ http://blog.niklas-heer.de/$1/ [R=301]
</IfModule>
# END Jekyll redirect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment