Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
share|improve this question

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
    
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

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 ??

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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