WordPress “comments” in .htaccess file

email

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

Related posts:

  1. Can’t Save/Publish Long Posts in WordPress
  2. Static Front Page
  3. Recent posts in category
  4. Embedding a Flash (FLV) file outside of the WordPress loop
  5. Favicon

About Bradley Charbonneau

I've done the big corporate thing. I've done the creative writer thing. Now I'm happily in the middle. I like to help small businesses who are interested in "working their website before their website works them." I'm also interested in creating beautiful sites with powerful WordPress themes.

, , , , ,

One Response to WordPress “comments” in .htaccess file

  1. Spencer Perry May 22, 2008 at 9:25 am #

    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 Reply

CommentLuv badge