Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 662991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:26:24+00:00 2026-05-13T23:26:24+00:00

I’m trying to deploy a site generated with Jekyll and would like to keep

  • 0

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, I’d like to use the contents of /jekyll as the root unless a file similarly named exists in the actual web root. So something like /jekyll/sample-page/ would show as http://www.example.com/sample-page/, while something like /other-folder/ would display as http://www.example.com/other-folder.

My test server runs Apache 2.2 and the following .htaccess (adapted from http://gist.github.com/97822) works flawlessly:

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 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.example.com/about into http://www.example.com/jekyll/about.
DirectorySlash off

However, my production server runs Apache 1.3, which doesn’t allow DirectorySlash. If I disable it, the server gives a 500 error because of internal redirect overload.

If I comment out the last section of ReWriteConds and rules:

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !/$
RewriteRule ^(.*)$ $1/

…everything mostly works: http://www.example.com/sample-page/ displays the correct content. However, if I omit the trailing slash, the URL in the address bar exposes the real internal URL structure: http://www.example.com/jekyll/sample-page/

What is the best way to account for directory slashes in Apache 1.3, where useful tools like DirectorySlash don’t exist? How can I use the /jekyll/ directory as the site root without revealing the actual URL structure?

Edit:

After a ton of research into Apache 1.3, I’ve found that this problem is essentially a combination of two different issues listed at the Apache 1.3 URL Rewriting Guide.

I have a (partially) moved DocumentRoot, which in theory would be taken care of with something like this:

RewriteRule   ^/$  /e/www/  [R]

I also have the infamous “Trailing Slash Problem,” which is solved by setting the RewriteBase (as was suggested in one of the responses below):

RewriteBase    /~quux/
RewriteRule    ^foo$  foo/  [R]

The problem is combining the two. Moving the document root doesn’t (can’t?) use RewriteBase—fixing trailing slashes requires(?) it… Hmm…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:26:25+00:00Added an answer on May 13, 2026 at 11:26 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.