Support » Fixing WordPress » htaccess code translation

  • 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

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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!

    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.

    Thread Starter Arlen

    (@bizwriter)

    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

    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.

    Thread Starter Arlen

    (@bizwriter)

    Thanks again!

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