I was wondering if anyone could help me with my .htaccess file for my local host Example. There are some errors on here that are displayed in red when I use: /http://htaccess.domain.be/ to test my Example; here are some of the errors on those lines:
I have also tried to add expired headers to the .htaccess but GTMetrix failed to recognize it. I basically added every
expires headers module I could find on the internet at no avail. I have also changed the position where I add it as well but couldn't succeed.
Bellow is my .htaccess and any help is much appreciated.
John
Code:
RewriteCond %{REQUEST_FILENAME} !-f This variable is not supported: %{REQUEST_FILENAME}
RewriteCond %{REQUEST_FILENAME} !-d This variable is not supported: %{REQUEST_FILENAME}
RewriteCond %{REQUEST_METHOD} POST This variable is not supported: %{REQUEST_METHOD}
RewriteCond %{HTTP_USER_AGENT} ^$ This variable is not supported: %{HTTP_USER_AGENT}
expires headers module I could find on the internet at no avail. I have also changed the position where I add it as well but couldn't succeed.
Bellow is my .htaccess and any help is much appreciated.
John
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^Example.com$
RewriteRule ^/?$ "http\:\/\/www\.Example\.com\/" [R=301,L]
# 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
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
Header unset ETag
FileETag None
# BLOCK HOTLINKING TO IMAGES
#RewriteEngine On
#RewriteCond %{HTTP_REFERER} !^https?://(www\.)?Example.com [NC]
#RewriteCond %{HTTP_REFERER} !^$
#RewriteRule .*\.(jpeg|jpg|gif|bmp|png)$ - [F]
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*Example.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
# protect wpconfig.php
<Files wp-config.php>
order allow,deny
deny from all
</Files>
# disable directory browsing
# For security reasons, Option all cannot be overridden.
#Options All -Indexes
Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
<Files ~ “^.*\.([Hh][Tt][Aa])”>
order allow,deny
deny from all
satisfy all
</Files>