The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess question

Discussion in 'General Discussion' started by kwmlr439, Aug 25, 2013.

  1. kwmlr439

    kwmlr439 Member

    Joined:
    Aug 24, 2013
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    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>
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Have you tried removing all of the existing rules, and adding one rule at a time to see which one it fails on? Note that you may find more help directly from the Mod_Rewrite forums:

    Mod_Rewrite Forums

    Thank you.
     
  3. kwmlr439

    kwmlr439 Member

    Joined:
    Aug 24, 2013
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    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!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page