Created
November 9, 2017 19:24
-
-
Save MatthiasKunnen/4a962076a4bcf73122e6f913451f9ce2 to your computer and use it in GitHub Desktop.
Rewrite spider to static HTML files
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
RewriteEngine On | |
# Remove trailing / | |
RewriteRule ^(.*)/$ /$1 [L,R=301] | |
# Rewrite spiders to static html | |
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|msnbot|yahoo|Baidu|aolbuild|facebookexternalhit|iaskspider|DuckDuckBot|Applebot|Almaden|iarchive|archive.org_bot) [NC] | |
RewriteCond %{DOCUMENT_ROOT}/static%{REQUEST_URI}.html -f | |
RewriteRule ^(.*)$ /static/$1.html [L] | |
# Rewrite spiders to static index.html | |
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|msnbot|yahoo|Baidu|aolbuild|facebookexternalhit|iaskspider|DuckDuckBot|Applebot|Almaden|iarchive|archive.org_bot) [NC] | |
RewriteCond %{REQUEST_URI} "^/$" | |
RewriteRule ^ /static/index.html [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment