Home Subscribe to this site with an RSS reader Search this site Contact Likoma Uh, a little help here, please?

WordPress “comments” in .htaccess file

By Bradley Charbonneau | Filed under Help, WordPress

I didn't realize I needed the WordPress "comments" in the .htaccess file. I just learned the hard way as a site went down, I checked the .htaccess file (one of the first places I look for a 500 error) and it looked like this:

CODE:
  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond %{REQUEST_FILENAME} !-f
  4. RewriteCond %{REQUEST_FILENAME} !-d
  5. RewriteRule . /index.php [L]
  6.  
  7. <IfModule mod_security.c>
  8. SecFilterEngine Off
  9. SecFilterScanPOST Off
  10. </IfModule>
  11.  
  12. # BEGIN WordPress
  13.  
  14. RewriteEngine On
  15. RewriteBase /
  16. RewriteCond %{REQUEST_FILENAME} !-f
  17. RewriteCond %{REQUEST_FILENAME} !-d
  18. RewriteRule . /index.php [L]
  19.  
  20. < IfModule mod_security.c>
  21. SecFilterEngine Off
  22. SecFilterScanPOST Off
  23. </IfModule>
  24.  
  25. # END WordPress

Hmm, doubled up. WP had automatically put in the second set of code when someone saved a post. Who knew. I read that if WP sees the comments, it will read what's in there and if it's already there, won't write it again. So what my .htaccess file should look like is just this:

CODE:
  1. # BEGIN WordPress
  2.  
  3. RewriteEngine On
  4. RewriteBase /
  5. RewriteCond %{REQUEST_FILENAME} !-f
  6. RewriteCond %{REQUEST_FILENAME} !-d
  7. RewriteRule . /index.php [L]
  8.  
  9. <IfModule mod_security.c>
  10. SecFilterEngine Off
  11. SecFilterScanPOST Off
  12. </IfModule>
  13.  
  14. # END WordPress


One Response to “WordPress “comments” in .htaccess file”

  1. Spencer Perry Says:

    You totally saved my life with this one! I kept crashing a site when I was updating a post and couldn't figure it out. Thanks!

Leave a Comment