Created
February 4, 2018 12:01
-
-
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
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
# 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