• Hi – I was taking a look at .htaccess and found this:

    # 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
    # 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
    
    # BEGIN wtwp_cache
    # END wtwp_cache
    
    # BEGIN wtwp_security
    # END wtwp_security

    I thought the duplicate code did not look right. I also checked out codex’s page on this: https://codex.www.ads-software.com/htaccess, as well as a couple of posts.

    It is unclear whether or not I can just delete one block of the duplicated code from this file and just save. Should I delete one block and save and not screw up anything? Please advise…TIA.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You are correct about the duplication being unnecessary, and you can also delete those others with nothing in them. The ‘#’ is a comment mark and anything following it on the same line is not any kind of active code.

    Out-of-the-box WordPress needs to be “hardened” for security, and you will learn a lot about htaccess by using and studying how BulletProof Security (plugin) does things.

    Thread Starter runamuck

    (@runamuck)

    So can I delete the extraneous code and save the file without doing any harm?

    That question covers too much ground for me…

    ex·tra·ne·ous
    adjective: extraneous

    irrelevant or unrelated to the subject at hand

    of external origin.

    separate from the object to which it is attached

    ??

    You can actually empty htaccess altogether and then go to Dashboard > Settings > Permalinks where a re-save will trigger WordPress to write what it needs…and then I would assume any plugin allowed to write htaccess — I *never* allow that for any plugin other than BPS — would again take care of its own.

    Thread Starter runamuck

    (@runamuck)

    So I tried this:
    Went to settings>Permalinks and saved to Default.

    Then I edited the .htaccess and deleted the “extra”

    # BEGIN WordPress
    # END WordPress

    Uploaded to directory and overwrote the existing .htaccess file. Then went back to Settings>Permalinks and clicked on the “pretty” permalink structure.

    I looked at the .htaccess file again and the “double” code appeared again.

    I tempted to repeat the above process, but deleting .htaccess after saving to default permalinks.

    Would that screw up the website?

    I know a little about htaccess but I know nothing about how permalinks work and I have only ever saved what I actually want at Settings > General > Permalinks. So, your overall questions are beyond me. In any case, the redundant code does not hurt anything…but maybe someone else knows why that is happening.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Basic .htaccess?’ is closed to new replies.