I\'m trying to deploy a site generated with Jekyll and would like to keep the site in its own subfolder on my server to keep everything more organized.
Essentially,
Finally got it, after a week of trying. RewriteRules really are voodoo…
RewriteEngine On
# Map http://www.example.com to /jekyll.
RewriteRule ^$ /jekyll/ [L]
# Map http://www.example.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 within jekyll
# This does not expose the internal URL.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^jekyll/(.*[^/])$ http://www.example.com/$1/ [R=301]
No need for DirectorySlash
. It magically all works.
The only simple solution worked for me is here
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]
Put this code into your .htaccess file.
domain-name.com – Type your own domain name
folder – Type the name of the subfolder which has the test/development website
You can simply use:
RewriteBase /jekyll
And everything starts from that point.