RewriteEngine On 3 times

Home Forums BulletProof Security Pro RewriteEngine On 3 times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41971
    Terry
    Participant

    I noticed that I have 3 RewriteEngine On statements in one of my htaccess files as shown below. One is added by WordPress which I thought was handled by BPS but not sure on the others. I know you should never have more than 1 RewriteEngine command. What is the best way to handle this in BPS Pro?

    # WP-ADMIN/INCLUDES
    # Use BPS Custom Code to remove this code permanently.
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/[^/]+\.php$ - [F]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F]
    RewriteRule ^wp-includes/theme-compat/ - [F]
    
    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    #41972
    Terry
    Participant

    I forgot to mention I also want to force http to https in the RewriteEngine  command that I need to add to BPS custom.

    #41973
    AITpro Admin
    Keymaster

    It is ok to have multiple instances of RewriteEngine On.  It will not cause any issues or problems.  The last section of code is the default WordPress Rewrite code.  The WP Rewrite code will be automatically removed after doing the steps in this forum topic to add the BPS SSL/HTTPS Rewrite htaccess code, which rewrites http to https > https://forum.ait-pro.com/forums/topic/wordpress-ssl-htaccess-code-rewrite-ssl-rewritecond-server_port/#post-7233

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.