Created
March 9, 2025 06:45
-
-
Save holly/5c0aef1b56c15cc979f12295b73351de to your computer and use it in GitHub Desktop.
wordpress htaccess
This file contains hidden or 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
<FilesMatch "^(xmlrpc|wp-cron|wp-trackback)\.php$"> | |
Require all denied | |
</FilesMatch> | |
# ${image}.jpg.webp, ${image}.png.webというファイルがあればURLは${image}.jpg, ${image}.pngというアクセスでも内部的に.webpファイルをレスポンスとして返す | |
<IfModule mod_mime.c> | |
AddType image/webp .webp | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP_ACCEPT} image/webp | |
RewriteCond %{SCRIPT_FILENAME}.webp -f | |
RewriteCond %{REQUEST_URI} (.*)\.(jpe?g|png)$ | |
RewriteRule (.+)\.(jpe?g|png)$ %{REQUEST_URI}.webp [T=image/webp,E=accept:1,L] | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header append Vary Accept env=REDIRECT_accept | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment