Viper Cache – where to add Viper Cache htaccess code in BPS Custom Code

Home Forums BulletProof Security Pro Viper Cache – where to add Viper Cache htaccess code in BPS Custom Code

This topic contains 8 replies, has 2 voices, and was last updated by  AITpro Admin 3 weeks, 3 days ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #35933

    guy te watson
    Participant

    Wp is crashing when vipercache code is added to the BSP htaccess securilty file code.  How can I get BPS to allow Vipercache code to be in the htaccess file along with BPS.  I put Vipercache in the Custom Code section in a couple of place one to put the code above BPS code and one that puts the code after BPS code in the htaccess file and still I get the below server crash. Please help me get vipercache to be able to work with my sites. I have several sites I need to put vipercache on

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@help-to-stop-foreclosure.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    #35934

    AITpro Admin
    Keymaster

    The 500 error occurred because you used/added invalid htaccess code in the root htaccess file. Most likely you copied plain text into your root htaccess file without commenting out the plain text with pound signs – #.  Post the Viper Cache htaccess code so I can tell you where to add it in BPS Custom Code.

    #35935

    guy te watson
    Participant

    That’s not helping because the security log is not coming up with a blocked message, but when I turn on vipercache and the BPS code and Vipercache code are both in the Security .htaccess file that BPS is creating as soon as the Vipercache code is intruduced the system crashes with the above error code on the website pages.  As soon as I ftp back in a default htaccess file or a file containing only Vipercache code or a file containing only BPS code it works fine on any one of those the types of htaccess files. It is only after I unlock the htaccess file and the “Activate” the Root htaccess security button and BPS combines the two Vipercache and BPS codes into the htaccess files that WordPress crashes. So it is definitely a problem with them two working together whether or not BPS is blocking Vipercache or not they are not working together, maybe it is crashing before BPS gets a chance to block. Whatever the case it is definitely an issue with BPS and Vipercache codes being together in the htaccess file. How else do I get this issue corrected and them working togerther in htaccess? There is nothing in the security log about blocking Vipercache. Below is the only thing created in the Security Log after I delete the log and uninstall and reinstall Vipercache and get it running.  I looked through and searched through with find feature in Notepad and found nothing in the security log before I deleted it and BPS created this fresh new log after I installed and ran Vipercache. Neither log shows any blocking of Vipercache so that’s not helping find the issue that I can tell.

    [deleted – not relevant to the problem]

    #35936

    guy te watson
    Participant

    OH Here is the  Viper Code

    #VIPERCACHESITECODE - Do not remove the following lines. Disable Web Caching in Viper Cache to remove this data.
    
    
    # Force compression for mangled Accept-Encoding request headers
    
    
    SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
    RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    
    
    
    # Compress all output labeled with one of the following media types.
    
    AddOutputFilterByType DEFLATE "application/atom+xml" \
    "application/javascript" \
    "application/json" \
    "application/ld+json" \
    "application/manifest+json" \
    "application/rdf+xml" \
    "application/rss+xml" \
    "application/schema+json" \
    "application/vnd.geo+json" \
    "application/vnd.ms-fontobject" \
    "application/x-font-ttf" \
    "application/x-javascript" \
    "application/x-web-app-manifest+json" \
    "application/xhtml+xml" \
    "application/xml" \
    "font/collection" \
    "font/eot" \
    "font/opentype" \
    "font/otf" \
    "font/ttf" \
    "image/bmp" \
    "image/svg+xml" \
    "image/vnd.microsoft.icon" \
    "image/x-icon" \
    "text/cache-manifest" \
    "text/calendar" \
    "text/css" \
    "text/html" \
    "text/javascript" \
    "text/plain" \
    "text/markdown" \
    "text/vcard" \
    "text/vnd.rim.location.xloc" \
    "text/vtt" \
    "text/x-component" \
    "text/x-cross-domain-policy" \
    "text/xml"
    
    
    # Map the following filename extensions to the specified
    # encoding type in order to make Apache serve the file types
    # with the appropriate Content-Encoding response header
    
    AddEncoding gzip svgz
    
    
    
    # Remove ETags as resources are sent with far-future expires headers.
    # FileETag None doesn't work in all cases.
    
    Header unset ETag
    
    FileETag None
    # Expires headers
    # Serve resources with far-future expires headers.
    
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    
    # CSS
    ExpiresByType text/css "access plus 1 month"
    
    # Data interchange
    ExpiresByType application/atom+xml "access plus 1 hour"
    ExpiresByType application/rdf+xml "access plus 1 hour"
    ExpiresByType application/rss+xml "access plus 1 hour"
    ExpiresByType application/json "access plus 0 seconds"
    ExpiresByType application/ld+json "access plus 0 seconds"
    ExpiresByType application/schema+json "access plus 0 seconds"
    ExpiresByType application/vnd.geo+json "access plus 0 seconds"
    ExpiresByType application/xml "access plus 0 seconds"
    ExpiresByType text/calendar "access plus 0 seconds"
    ExpiresByType text/xml "access plus 0 seconds"
    
    # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
    ExpiresByType image/x-icon "access plus 1 week"
    
    # HTML
    ExpiresByType text/html "access plus 0 seconds"
    
    # JavaScript
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType application/x-javascript "access plus 1 year"
    ExpiresByType text/javascript "access plus 1 year"
    
    # Manifest files
    ExpiresByType application/manifest+json "access plus 1 week"
    ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
    ExpiresByType text/cache-manifest "access plus 0 seconds"
    
    # Markdown
    ExpiresByType text/markdown "access plus 0 seconds"
    
    # Media files
    ExpiresByType audio/ogg "access plus 1 month"
    ExpiresByType image/bmp "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType video/mp4 "access plus 1 month"
    ExpiresByType video/ogg "access plus 1 month"
    ExpiresByType video/webm "access plus 1 month"
    
    # Web fonts
    # Collection
    ExpiresByType font/collection "access plus 1 month"
    
    # Embedded OpenType (EOT)
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    ExpiresByType font/eot "access plus 1 month"
    
    # OpenType
    ExpiresByType font/opentype "access plus 1 month"
    ExpiresByType font/otf "access plus 1 month"
    
    # TrueType
    ExpiresByType application/x-font-ttf "access plus 1 month"
    ExpiresByType font/ttf "access plus 1 month"
    
    # Web Open Font Format (WOFF) 1.0
    ExpiresByType application/font-woff "access plus 1 month"
    ExpiresByType application/x-font-woff "access plus 1 month"
    ExpiresByType font/woff "access plus 1 month"
    
    # Web Open Font Format (WOFF) 2.0
    ExpiresByType application/font-woff2 "access plus 1 month"
    ExpiresByType font/woff2 "access plus 1 month"
    
    # Other
    ExpiresByType text/x-cross-domain-policy "access plus 1 week"
    
    
    
    #Prevents garbled chars in cached files if there is no default charset.
    AddDefaultCharset utf-8
    
    #Cache rules:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} on
    RewriteRule .* - [E=WRDFNC_HTTPS:_https]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTPS} off
    RewriteCond %{QUERY_STRING} ^(?:\d+=\d+)?$
    RewriteCond %{REQUEST_URI} (?:\/|\.html)$ [NC]
    RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_logged_in|wptouch_switch_toggle|wpmp_switcher|wp_woocommerce_session|safirmobilswitcher=mobil) [NC]
    RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
    RewriteCond %{REQUEST_URI} \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$
    RewriteCond "%{DOCUMENT_ROOT}/wp-content/uploads/vipercache/%{HTTP_HOST}_%1/%2_%3_%4_%5_%6_vipercache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" -f
    RewriteRule \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$ "/wp-content/uploads/vipercache/%{HTTP_HOST}_$1/$2_$3_$4_$5_$6_vipercache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" [L]
    
    
    #Do not remove the above lines. Disable Web caching in Viper Cache to remove this data - VIPERCACHESITECODE
    #35937

    AITpro Admin
    Keymaster

    Ok let’s clear this up first – “So it is definitely a problem with them two working together whether or not BPS is blocking Vipercache or not they are not working together, maybe it is crashing before BPS gets a chance to block. Whatever the case it is definitely an issue with BPS and Vipercache codes being together in the htaccess file.”

    The only partially valid part of the statement above is that when Viper Cache htaccess code is added to your root htaccess file then your website crashes.  BPS is not interfering with Viper Cache htaccess code.  The problem is the Viper Cache htaccess code itself.  So I am willing to help you figure this out even though you should probably be contacting Viper Cache support to figure out why their code is causing your website to crash.

    Ok now that we are on the same page, let’s begin to try and figure out what is fubar about Viper Cache…

    I do not see any clear htaccess code mistakes, but I do see some very poorly written Viper Cache htaccess code.  It appears that the person who created this htaccess code has a limited knowledge of htaccess code.  I believe this section of Viper Cache htaccess code below is the code that is crashing your website.  So do these steps below to confirm that is the fubar Viper Cache code.

    1. Add the Viper Cache htaccess code to this BPS Root Custom Code text box: 1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE
    2. Delete the section of Viper Cache htaccess code below from the 1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE text box.
    3. Click the Save Root Custom Code button.
    4. Go to the Security Modes page and click the Root folder BulletProof Mode Activate button.

    Important Note:  I believe the section of Viper Cache htaccess code is critical to Viper Cache performing correctly, but at this point you are just trying to figure out which fubar Viper Cache htaccess code is crashing your website.  Once we have confirmed that then you will need to contact Viper Cache support and have them fix their fubar htaccess code.

    #Prevents garbled chars in cached files if there is no default charset.
    AddDefaultCharset utf-8
    
    #Cache rules:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} on
    RewriteRule .* - [E=WRDFNC_HTTPS:_https]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTPS} off
    RewriteCond %{QUERY_STRING} ^(?:\d+=\d+)?$
    RewriteCond %{REQUEST_URI} (?:\/|\.html)$ [NC]
    RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_logged_in|wptouch_switch_toggle|wpmp_switcher|wp_woocommerce_session|safirmobilswitcher=mobil) [NC]
    RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
    RewriteCond %{REQUEST_URI} \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$
    RewriteCond "%{DOCUMENT_ROOT}/wp-content/uploads/vipercache/%{HTTP_HOST}_%1/%2_%3_%4_%5_%6_vipercache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" -f
    RewriteRule \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$ "/wp-content/uploads/vipercache/%{HTTP_HOST}_$1/$2_$3_$4_$5_$6_vipercache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" [L]
    
    #35938

    guy te watson
    Participant

    No even with the “Cache Rules” section removed it still crashes when the BPS security file is activated.  But it works fine with the Full Vipercache code including the “Cache Rules” section without BPS code present and visa versa BPS works fine without the Vipercache code present, so it looks to me like there is a conflict between the codes. I am not blaming BPS because it works fine with most everything else especially with being able to create a white-list if something is being blocked, so I am not Blaming BPS, I am just trying to get Vipercache to work with BPS.

    #35939

    AITpro Admin
    Keymaster

    Ok well I am not sure which fubar Viper Cache htaccess code is causing the problem then.  BPS htaccess code works on 500,000+ web hosts around the world and with all other htaccess code in other caching plugins – W3TC, WP Rocket, WP Super Cache, EPC Cache, Comet Cache, etc etc etc etc….  So technically you are describing the problem backwards.  I do not understand how what you are describing is even possible, unless of course the Rewrite section of Viper Cache is so terribly fubar that it will only work alone and not with any other htaccess code.  Are you getting the idea now?  We have made BPS compatible with everything else so that this type of Viper Cache plugin problem does not happen between BPS and W3TC, WP Rocket, WP Super Cache, EPC Cache, Comet Cache, etc etc etc etc….  I am not being defensive.  I just want for you to see the real problem.  😉

    At this point send me a WordPress Administrator login to this website and an FTP login to your hosting account > info at ait-pro dot com.  I will have to do trial and error with the fubar Viper Cache htaccess code until I can isolate the problem Viper Cache htaccess code.  I do not have the time to work on this Viper Cache plugin problem tonight.  So I will be able to work on the Viper Cache plugin problem tomorrow morning.

    #35940

    guy te watson
    Participant

    Okay I have sent the email. Thanks!

    #35943

    AITpro Admin
    Keymaster

    Ok the problem is fixed.  The htaccess code that you copied into BPS Custom Code was not valid.  It contained whitespaces and hidden formatting.  The reason it was not valid is because you copied the code from a non-ASCII app, utility, etc.  You cannot copy htaccess code from non-ASCII apps such as Microsoft Word or Wordpad, etc. because hidden formatting will be included in the copy and paste.  You must use an ASCII app such as Notepad, Notepad++, Dreamweaver, etc. when copying htaccess code.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.