Custom Code

The Own Code field in the User Agents tab allows you to append arbitrary .htaccess directives to the generated configuration. This is an advanced option for rules that do not fit the structured options in the other tabs.

When to use custom code

Use the Own Code field when you need to:

  • Add custom RewriteRule or RewriteCond directives
  • Block access to specific files, directories, or URL patterns not covered by the built-in options
  • Add custom HTTP headers not available in the HTTP Headers tab
  • Implement site-specific security or performance rules

How to use it

Enter valid Apache or IIS directives in the text area in the User Agents tab, one directive per line. The code is appended verbatim to the .htaccess file after the SecurityCheck Pro-managed rules.

An Expand button opens the text area into a larger overlay for easier editing.

Custom code is not validated before being written to the .htaccess file. Incorrect syntax can take your site offline immediately. Always back up your .htaccess file before adding custom directives, and test in a development environment first.

Custom code added here is part of the .htaccess Protection configuration. If you click Apply Default Config on the Dashboard, custom code fields are not reset, but the other managed rules may be modified.

Own Code text area with Expand button for custom directives