Last active
July 20, 2020 18:55
-
-
Save earth3300/55cc52d661558f98df4622d6853fc4d0 to your computer and use it in GitHub Desktop.
# Rewrite all requests to /foo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rewrite to the cached file if it exists and is not a post or attachment. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# RewriteCond %{REQUEST_METHOD} !=POST | |
# RewriteCond %{QUERY_STRING} !.*=.* | |
# RewriteCond %{DOCUMENT_ROOT}/$1/index.html -f | |
# RewriteRule ^(.*) /$1/index.html [L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rewrite all requests to /foo | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{SERVER_NAME} www.foo.tld | |
RewriteCond %{REQUEST_URI} !^/foo/ | |
RewriteRule ^(.*)$ /foo/$1 [L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Server Configuration for the Site Root | |
# | |
# Use when all site files are placed in a directory. | |
# The <IfModule> is required for the site to work. | |
# The entire site can be shunted to a new /{dir}/ if needed. | |
# | |
# File: /.htaccess (Root) | |
# Created: 2020-07-20 | |
# Time 18:52 UTC | |
# Lines: 22 | |
# Length: 552 | |
# Rewrite all requests to /{dir}/ | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{SERVER_NAME} www.foo.tld | |
RewriteCond %{REQUEST_URI} !^/{dir}/ | |
RewriteRule ^(.*)$ /{dir}/$1 [L] | |
</IfModule> | |
# A generic backup is at: /.htaccess-root. |
.htaccess-dir-cached is a snippet designed to look first for and return a cached file, but only if the request is not a POST request or an attachment. An additional line which is platform specific and related to cookies is excluded from this snippet: (RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Each line is required. See:
https://github.com/earth3300/ec01/wiki/Forward-Slash
for a discussion.