Skip to content

Instantly share code, notes, and snippets.

@webdevsyd
Created May 22, 2017 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdevsyd/70db697d20c62c8603402dcaa8a1d176 to your computer and use it in GitHub Desktop.
Save webdevsyd/70db697d20c62c8603402dcaa8a1d176 to your computer and use it in GitHub Desktop.
RewriteEngine On
RewriteBase /
# Yoast SEO - XML Sitemap Rewrite Fix
RewriteRule ^sitemap_index.xml$ /index_wp.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index_wp.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index_wp.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index_wp.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index_wp.php?xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php/$0 [PT,L]
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "9HQbYSRZbF33xH6Jy9Ey"
</IfModule>
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
# Only proxy the request to Prerender if it's a request for HTML
RewriteRule ^(?!.*?(\.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))(.*) http://service.prerender.io/http://staging.e27.co/$2 [P,L]
</IfModule>
#Header set Cache-Control "max-age=2628000, public"
#Header set Pragma "cache"
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType font/ttf "access plus 1 month"
ExpiresByType font/otf "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/js "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/mov "access plus 1 month"
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment