CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 17:30:46 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=HEUs9NVxFnJcgnULnFacGgMUFvnO1Bd7FyuxzJ31iC0BFBwadHTKnzZDXGb2OzUeYlmMe5pHTpPhUDZW2VywjcYhD9TpMg8oWwe4OMm7CYjABufJ"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 98d016534f397fa8-BLR
gform_upload_root_htaccess_rules - Gravity Forms Documentation
gform_upload_root_htaccess_rules
Description
A filter to allow to turn off or modify rules being added to the .htaccess file created for the base upload path. It runs daily during the regeneration of the .htaccess file.
Please consult your system administrator before using this filter.
Usage
The following would apply to all forms.
add_filter('gform_upload_root_htaccess_rules', 'my_filter_function');
Parameters
- $rules Mixed
The Rules of what to parse or not to parse
Examples
Prevent Gravity Forms from adding default rules to the file
This will only stop Gravity Forms from adding the default rules to the .htaccess file created, after the removal of the existing .htaccess file done daily by the cron task gravityforms_cron
add_filter( 'gform_upload_root_htaccess_rules', '__return_false' );
Add new new rules to the .htaccess files
The example below would allow you to add new lines to the .htaccess being regenerated by cron task.
add_filter( 'gform_upload_root_htaccess_rules', function( $rules ) {
$rules[] = 'a new line in the file';
$rules[] = 'another new line';
GFCommon::log_debug( __METHOD__ . '(): .htaccess rules => ' . print_r( $rules, true ) );
return $rules;
} );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in common.php