WordPress.org

Ready to get started?Download WordPress

Forums

What's wrong with our .htaccess? (4 posts)

  1. StMarysWB
    Member
    Posted 2 years ago #

    It looks like there is something wrong with our .htaccess code, whenever we add .txt to the end of the .htaccess file name, the site runs perfectly, however, enable the .htaccess file - we get the error 500 internal server error message.

    Here is all of the .htaccess:

    # 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
    
    order allow,deny
    deny from 197.0.130.4
    deny from 41.224.0.0 - 41.231.255.255
    deny from 46.36.198.91 - 46.36.198.95
    deny from 67.216.163.112 - 67.216.163.127
    deny from 80.85.27.200 - 80.85.27.207
    deny from 81.31.195.216 - 81.31.195.219
    deny from 86.66.13.96 - 86.66.13.111
    deny from 192.68.138.0 - 192.68.138.255
    deny from 193.95.0.0 - 193.95.127.255
    deny from 196.203.0.0 - 196.203.255.255
    deny from 196.216.156.0 - 196.216.159.255
    deny from 197.0.0.0 - 197.31.255.255
    deny from 207.65.70.32 - 207.65.70.47
    deny from 207.65.70.80 - 207.65.70.95
    deny from 207.65.70.144 - 207.65.70.151
    deny from 207.65.71.48 - 207.65.71.63
    deny from 208.114.116.184 - 208.114.116.191
    deny from 213.150.160.0 - 213.150.191.255
    deny from 216.153.65.0 - 216.153.65.63
    allow from all
    
    #Expires Headers
    ExpiresActive On
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    
    #New Hotlinking
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?stmaryswestbank\.org.uk/ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?translate\.googleusercontent\.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://lh3.ggpht.com/_JZOYQPGSOqk/TT3OlnoTDuI/AAAAAAAAAC0/ogbgBQlzbn8/hotlinker.png [L]
    
    #Compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    
    #Disable Directory Browsing
    Options  -Indexes
    
    #Options FollowSymLinks Indexes
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} (\"|%22).*(\>|%3E|<|%3C).* [NC]
    RewriteRule ^(.*)$ log.php [NC]
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC]
    RewriteRule ^(.*)$ log.php [NC]
    RewriteCond %{QUERY_STRING} (javascript:).*(\;).* [NC]
    RewriteRule ^(.*)$ log.php [NC]
    RewriteCond %{QUERY_STRING} (\;|\’|\"|\%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if).* [NC]
    RewriteRule ^(.*)$ log.php [NC]
    RewriteRule (,|;|<|>|’|) /log.php [NC]

    Can anyone see what is wrong with it? Or suggest a way to fix this?

  2. inkdipt
    Member
    Posted 2 years ago #

    copy all bu the wordpress code and paste that into a text document and save it. Delete everything bu the wordpress code and load that .htaccess. Then if it shows up add each code individually until you find the one that breaks it and break that code down by line until you find the line that is breaking it.

    unfortunately this is probably a server issue that is why I am telling you to do it this way. There is no real problem with the code you have therefore it is probably a rule that the server does not support.

    Just a caveat: lots of shared host don't support expired headers.

  3. StMarysWB
    Member
    Posted 2 years ago #

    I've done what you said, even with just the WordPress stuff gives the 500 internal server error. Luckily, I've got a backup of the .htaccess. I've uploaded that and it works, but If I I go to make a change to this backup .htaccess and save it, the error returns again.

  4. wprock
    Member
    Posted 2 years ago #

    edit your .htaccess file. First delete all the content . After that put the below code in the file and save the file.

    # 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

Topic Closed

This topic has been closed to new replies.

About this Topic