Content Security and modifying what is secured

Estimated reading time: 1 min

What is Content Security?

Content Security in GrassBlade xAPI Companion refers to a feature that allows you to secure your static content. This way even if someone gets direct link i.e the Content URL, they cannot access it unless they are logged in.

Enable/Disable Content Security

Step 1:
In the WordPress Dashboard, go to GrassBlade > GrassBlade Settings > Content Settings.

Step 2:
Check the box called Enable Content Security and click the Update Settings button to save. (Click on the image to enlarge)

GrassBlade Content Security

If you want to disable this feature, just un-check that box and click the update settings button.

This feature will not work if you enable tracking for guest users. So, make sure “Track Guest Users” is set to” ‘NO”, in the global content settings. 

How to add or remove the file types that are secured?

You need to follow these steps if you want to add or remove some file types that are secured by Content Security feature:

  • Copy the file /wp-content/plugins/grassblade/addons/security/htaccess.txt to /wp-content/themes/<your theme directory>/htaccess.txt
  • You will see a string section ike: (gif|jpe?g|png|mp4|mp3|mpe?g|avi|html?|js)
  • You can add or remove file extensions to it. e.g.
  1.     Added “pdf”: (gif|jpe?g|png|mp4|mp3|mpe?g|avi|html?|js|pdf)
  2.     Removed “mp3”: (gif|jpe?g|png|mp4|mpe?g|avi|html?|js)
  • Add the following code to your/wp-content/themes/<your theme directory>/functions.php file:

add_filter("grassblade_security_htaccess_file_template",
"custom_grassblade_security_htaccess_file_template", 10, 2);
function custom_grassblade_security_htaccess_file_template($file, $post_id) {
return dirname(__FILE__)."/htaccess.txt";
}

  • Go to WP ADMIN > GrassBlade > GrassBlade Settings > Content Settings > Enable Content Security
  • Disable Content Security and Save settings.
  • Re-enable Content Security and Save settings again.

If you’re facing any issues while using this feature, feel free to contact us.

Was this article helpful?
Dislike 0 10 of 10 found this article helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *