Created
January 15, 2020 23:05
-
-
Save jeremyblaze/8dec3fce3852ca9adc1cf679962c582c to your computer and use it in GitHub Desktop.
Fixes page links on exported Webflow sites
This file contains 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
Options -Multiviews -Indexes +FollowSymLinks | |
DirectorySlash Off | |
RewriteEngine On | |
RewriteBase / | |
# Remove .html at the end of the request | |
RewriteCond %{THE_REQUEST} "^(GET|POST|HEAD) /(.*).html(\?.*)? HTTP/[0-9.]+$" | |
RewriteRule ^(.*)\.html $1 [R=301,L] | |
# Remove trailing slash | |
RewriteRule ^(.*)/$ $1 [R=301,L] | |
# Redirect /index to / | |
RewriteRule ^index$ ? [R=301,L] | |
# Output .html file content for non-html URLs | |
RewriteCond ${REQUEST_URI} !^(.*)\.html(\?.*)?$ | |
RewriteCond %{REQUEST_FILENAME}.html -f | |
RewriteRule ^(.*)/?$ $1.html [L] | |
# Special case for folders | |
RewriteCond ${REQUEST_URI} !^(.*)\.html(\?.*)?$ | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^(.*)/$ $1.html [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment