Skip to content

Instantly share code, notes, and snippets.

@ignas-sakalauskas
Created February 4, 2018 12:01
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 ignas-sakalauskas/fbb725e6a45f40e55d82c6a61ef3442b to your computer and use it in GitHub Desktop.
Save ignas-sakalauskas/fbb725e6a45f40e55d82c6a61ef3442b to your computer and use it in GitHub Desktop.
WordPress .htaccess with static files expiration tweak, HTTPS redirect, and SEO friendly URLs
# BEGIN Expiry date
<FilesMatch ".(ico|jpg|jpeg|png|gif|css|js)$">
ExpiresActive On
ExpiresDefault "access plus 1 month"
</FilesMatch>
# END Expiry date
# HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# END HTTPS
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment