WordPress.org

Ready to get started?Download WordPress

Forums

htaccess code translation (6 posts)

  1. BizWriter
    Member
    Posted 5 months ago #

    Can someone tell me why wordpress htaccess has four lines of code after # END WordPress? What are those four lines supposed to do? I'm trying to add more code to harden my site but not sure where to add it. After # END wtwp_security?
    Thanks!

    # 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

  2. arncus
    Member
    Posted 5 months ago #

    Hi Bizwriter,

    Looks they are added by plugins. However, as per your copy above, each line is simply a remark - meaning it has absolutely no affect on your site. The "#" sign indicates it as a remark. In this case it simply marks the beginning and ending of the code. .htaccess runs the code in order from top to bottom. So, if you want to add something, I would add probably add it AFTER the WordPress re-writes unless you're trying to do something that needs to take effect before the WordPress section is used.

    Hope that helps!

  3. leejosepho
    Member
    Posted 5 months ago #

    The # BEGIN and # END lines tell plugins and such to leave the in-between lines alone unless specifically writing to those sections, and you can enclose your security lines within your own # BEGIN SECURITY and #END SECURITY "fences", if you wish. And for security things such as denying access to certain files like wp-config and so on, I typically put those near the top.

  4. BizWriter
    Member
    Posted 5 months ago #

    Thanks arncus and leejosepho! I'm a bit of a newbie at this stuff so had to ask to clarify. So I should add code after the # END WordPress line and can delete the following? Thanks
    # BEGIN wtwp_cache
    # END wtwp_cache

    # BEGIN wtwp_security
    # END wtwp_security

  5. leejosepho
    Member
    Posted 5 months ago #

    Those lines appear to be from plugins, and you can delete them if they do not need to be there...and yes, you can add your own code either before or after whatever else.

  6. BizWriter
    Member
    Posted 5 months ago #

    Thanks again!

Reply

You must log in to post.

About this Topic

Tags

No tags yet.