kwmlr439

Member
Aug 24, 2013
12
1
3
cPanel Access Level
Website Owner
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:
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}
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:
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>
 

kwmlr439

Member
Aug 24, 2013
12
1
3
cPanel Access Level
Website Owner
Yes I have trying what you suggested and it's not working Michael. Thank you for your response! I have also loooked at the forum you sent and I don't see a way to register. Very Weird!
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
It does appear those forums are no longer active. Thank you for pointing that out. As far as the rules, could you let us know the first rule it fails at when you try adding them in one by one?

Thank you.