-1

I just found my '.htaccess' file has the same lines of code repeated twice as below, maybe some plugins changed it, is it incorrect? Should I remove the repeated one? Thanks!!

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# 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
0

This often happens when using a plugin like WP Super Cache or W3 Total Cache that need to add things to the .htaccess file. You can safely delete the top version (the one without the BEGIN/END WordPress lines), but having duplicate entries won't hurt anything. It will add a tiny bit of overhead as the rules are processed, but it's negligible on a site that isn't getting very large amounts of traffic.

3
  • Thanks, btw, I have two .htaccess files, one is located in '/httpdocs/', another one is located in '/httpdocs/wordpress/', the content is different, is it normal?
    – RRN
    Aug 26 '12 at 12:48
  • @RRN it depends ... did you also recently change WordPress to a subdirectory install?
    – Damien
    Aug 26 '12 at 12:54
  • I asked this question here: wordpress.stackexchange.com/questions/63114/…
    – RRN
    Aug 26 '12 at 15:59
0

Gavin is mostly right ... you can ignore the code.

However W3TC actually starts their edits in the .htaccess with # BEGIN W3TC Browser Cache so the most likely reason is someone manually added the <IfModule mod_rewrite.c> block (perhaps when you first setup WordPress). This can happen if WordPress was not setup correctly with the right Permissions to write the .htaccess file.

Then later, you fixed the permissions and changed your Permalinks - then WordPress was able to automatically write to the .htaccess file.

Or ... you read somewhere to create the .htaccess file and added the code yourself ??

1
  • Thanks, I think I belong to this case: "Then later, you fixed the permissions and changed your Permalinks - then WordPress was able to automatically write to the .htaccess file."
    – RRN
    Aug 26 '12 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.