Title: .htaccess problem
Last modified: August 19, 2016

---

# .htaccess problem

 *  [maliq](https://wordpress.org/support/users/maliq/)
 * (@maliq)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/)
 * Hi:
 * After enabling permalink on my blog, WordPress automatically created a .htaccess
   file in the site’s root directory. Everything was working properly. Recently,
   I had to deal with some unfriendly visitors to my blog whom I’d like to ban from
   my site using .htaccess.
 * I downloaded the original htaccess file which looked like this
    —- # BEGIN WordPress
   <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME}!-
   f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule
   >
 * # END WordPress
    —-
 * and added the following lines after “# END WordPress.”
    —- order allow,deny deny
   from IP deny from IP allow from all —-
 * After reuploading the modified htaccess file, I got an Internal Server Error 
   and couldn’t access my blog anymore. I had to delete the htaccess file per ftp
   and re-activated permalink.
 * Any idea how I can include the ban codes in the htaccess file without causing
   a server error?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [DianeV](https://wordpress.org/support/users/dianev/)
 * (@dianev)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722478)
 * I’m not sure about your coding. Is it set up like this?
 *     ```
       <Files .htaccess>
       Order Deny,Allow
       Deny from all
       </Files>
       ```
   
 * And is the “IP” replaced by an actual IP address?
 *  Thread Starter [maliq](https://wordpress.org/support/users/maliq/)
 * (@maliq)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722483)
 * >I’m not sure about your coding. Is it set up like this?
    [code]
 * Oh, I didn't include the <Files .htaccess>-tag? Could that be the problem?
 * >And is the "IP" replaced by an actual IP address?
 * Yes.
 *  Thread Starter [maliq](https://wordpress.org/support/users/maliq/)
 * (@maliq)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722486)
 * Just tried it out with the tag. Same problem. 🙁
 *  [DianeV](https://wordpress.org/support/users/dianev/)
 * (@dianev)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722597)
 * > Oh, I didn’t include the <Files .htaccess>-tag? Could that be the problem?
 * Absolutely; you have to “open” and “close” that section with the tags.
 * Try taking out the IP address lines.
 *  [evilbeet](https://wordpress.org/support/users/evilbeet/)
 * (@evilbeet)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722722)
 * Hey Maliq,
 * Do you want to ban them from viewing or just ban them from commenting?
 * If you just want to ban them from commenting, blacklist their IPs under Options-
   >Discussion. Much easier than messing with .htaccess, plus you can still get 
   their page views.
 * If you want to ban them even from viewing, read this:
 * [http://lorelle.wordpress.com/2007/09/20/the-easiest-way-to-ban-a-wordpress-spammer/](http://lorelle.wordpress.com/2007/09/20/the-easiest-way-to-ban-a-wordpress-spammer/)
 * And use this:
 * [http://tools.dynamicdrive.com/userban/](http://tools.dynamicdrive.com/userban/)
 *  Thread Starter [maliq](https://wordpress.org/support/users/maliq/)
 * (@maliq)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722781)
 * Hi:
 * Thanks very much for the replies. After doing some googling on my own I found
   another possibilty: [http://lesterchan.net/wordpress/readme/wp-ban.html](http://lesterchan.net/wordpress/readme/wp-ban.html)
 * It’s a nifty plug-in that offers pretty much everything I needed and the best
   thing is you don’t have to screw with the .htaccess file. 🙂
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-722793)
 * This should work fine.
 *     ```
       <IfModule mod_access.c>
       Order Allow,Deny
       Deny from IP
       Allow from All
       </IfModule>
       ```
   
 * The ifmodule protect you from errors if the mod_access is not enabled.
 * If you still get 500 errors, then your host has broken something. Talk to them
   about it.
 *  [xjessie007yahoocom](https://wordpress.org/support/users/xjessie007yahoocom/)
 * (@xjessie007yahoocom)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-723573)
 * I agree, something was missing in your code. The directives are often enclosed
   with the **<Directory>** tag in your httpd.conf. When talking about the .htaccess
   file, they are often enclosed with **<FilesMatch>** tag.
 * See here for the correct syntax: [Order allow,deny](http://www.maxi-pedia.com/Order+allow+deny)

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘.htaccess problem’ is closed to new replies.

## Tags

 * [htaccess](https://wordpress.org/support/topic-tag/htaccess/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 5 participants
 * Last reply from: [xjessie007yahoocom](https://wordpress.org/support/users/xjessie007yahoocom/)
 * Last activity: [17 years, 6 months ago](https://wordpress.org/support/topic/htaccess-problem-4-2/#post-723573)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
