• Resolved Miz.Michele

    (@mizmichele)


    Hello,

    I can’t access my site stats and I need to add this code to my .htaccess

    ErrorDocument 401 "Error"
    ErrorDocument 403 "Error"
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
    RewriteRule . - [L]
    </IfModule>

    I don’t know which box to add it to in the custom code section. There’s so many! Can someone tell me exactly where to add it.

    http://wordpress.org/plugins/bulletproof-security/

Viewing 11 replies - 1 through 11 (of 11 total)
  • You MUST copy and paste the entire WP REWRITE LOOP START section of code from your root .htaccess file into this text box first. You can then edit and modify the code in this text window and save your changes.

    So, I would likely try the CUSTOM CODE WP REWRITE LOOP START box, like this:

    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    ## access my site stats
    RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
    RewriteRule . - [L]

    The boss might say something different when he gets here, but that might work fine.

    Plugin Author AITpro

    (@aitpro)

    Nice try leejosepho! This is what I would have tried first too. 😉 This stats .htaccess code is for DreamHost stats and for whatever reason it does not work correctly in the WP Rewrite Loop code.

    http://wiki.dreamhost.com/Making_stats_accessible_with_htaccess

    BPS already has ErrorDocument directives in the root .htaccess file so you do not need to add these 2 lines of code:
    ErrorDocument 401 “Error”
    ErrorDocument 403 “Error”

    Copy your stats .htaccess code below to this Custom Code text box: CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE: Add php.ini handler and/or plugin cache code here…

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
    RewriteRule . - [L]
    </IfModule>

    …If you are using php/php.ini handler code or have cache code already in this text box then put your stats code after the php/php.ini handler code and before the cache code…

    php/php.ini code
    stats code
    cache code

    …click the Save Root Custom Code button, go to the Security Modes page, click the Create secure.htaccess File AutoMagic button and activate Root folder BulletProof Mode again.

    Nice try leejosepho! This is what I would have tried first too. 😉

    Well, at least now I have my error for the day out of the way.

    @miz.Michele: Oops, please pardon any inconvenience I might have caused.

    Plugin Author AITpro

    (@aitpro)

    Not an error at all my friend. A lot of things are trial and error based on logic when it comes to .htaccess code. It just so happens that what you cannot know in this particular case is what the Host Server expects and requires (unless you have the same Host & Server type). In general, I do a Google search first to see if this is a known thing and then go for the trial and error. 😉

    Plugin Author AITpro

    (@aitpro)

    Resolving.

    Thread Starter Miz.Michele

    (@mizmichele)

    Thank you. I am going to try right now.
    @leejoepho no problem
    I appreciate the help

    Thread Starter Miz.Michele

    (@mizmichele)

    It did not work for me. Looking at your model I added it to the top, right? This is what is in the box.

    # BEGIN W3TC Page Cache core
    #...
    # END W3TC Page Cache core
    # BEGIN W3TC Minify cache
    <IfModule mod_mime.c>
        AddEncoding gzip .gzip
        <Files *.css.gzip>
            ForceType text/css
        </Files>
        <Files *.js.gzip>
            ForceType application/x-javascript
        </Files>
    </IfModule>
    <IfModule mod_deflate.c>
    
    What did I do wrong?
    Plugin Author AITpro

    (@aitpro)

    Copy your stats .htaccess code below to this Custom Code text box: CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE: Add php.ini handler and/or plugin cache code here

    DreamHost stats code here
    W3TC cache code here

    …click the Save Root Custom Code button, go to the Security Modes page, click the Create secure.htaccess File AutoMagic button and activate Root folder BulletProof Mode again.

    Like this, I think:

    # DreamHost stats code
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
    RewriteRule . - [L]
    </IfModule>
    #
    # BEGIN W3TC Page Cache core
    #...
    # END W3TC Page Cache core
    # BEGIN W3TC Minify cache
    <IfModule mod_mime.c>
        AddEncoding gzip .gzip
        <Files *.css.gzip>
            ForceType text/css
        </Files>
        <Files *.js.gzip>
            ForceType application/x-javascript
        </Files>
    </IfModule>
    <IfModule mod_deflate.c>

    Plugin Author AITpro

    (@aitpro)

    Also Minifying code may not work with the DreamHost stats code due to the nature of what/how minifying does what it does. I would test with turning off minify in W3TC. You will need to unlock your root .htaccess file first before saving your W3TC settings so that W3TC can write new code to your root .htaccess file. Then copy that new W3TC code to BPS Custom Code and overwrite the existing W3TC code in BPS Custom Code.

    Thread Starter Miz.Michele

    (@mizmichele)

    Thanks. It’s working.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Which custom code box do I use?’ is closed to new replies.