Created
October 19, 2021 15:10
-
-
Save tyluudinh/2149d6cc62219c141f619682b5378c47 to your computer and use it in GitHub Desktop.
Apache2 + angular + prerender.io
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
<IfModule mod_proxy_http.c> | |
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp [NC,OR] | |
RewriteCond %{QUERY_STRING} _escaped_fragment_ | |
RewriteCond %{REQUEST_URI} ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent|\.ttf|\.woff|\.svg)) | |
RewriteRule ^(index\.html|index\.php)?(.*) https://service.prerender.io/%{REQUEST_SCHEME}://%{HTTP_HOST}/$2 [P,END,L] | |
</IfModule> | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# -- REDIRECTION to https (optional): | |
# If you need this, uncomment the next two commands | |
# RewriteCond %{HTTPS} !on | |
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} | |
# -- | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d | |
RewriteRule ^.*$ - [NC,L] | |
RewriteRule ^(.*) index.html [NC,L] | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header set Cache-Control "no-cache, no-store, must-revalidate" | |
Header set Pragma "no-cache" | |
Header set Expires 0 | |
</IfModule> | |
<IfModule mod_headers.c> | |
RequestHeader set X-Prerender-Token "YOUR_TOKEN" | |
RequestHeader set X-Prerender-Version "[email protected]" | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment