apply_filters( 'mod_rewrite_rules', string $rules )

Filters the list of rewrite rules formatted for output to an .htaccess file.


Parameters

$rules

(string) mod_rewrite Rewrite rules formatted for .htaccess.


Top ↑

Source

File: wp-includes/class-wp-rewrite.php

View on Trac



Top ↑

Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Shoaib Ali
    // Setting the X-Content-Type-Options Header
    function add_headers_htaccess( $rules ) {
      $new_rule = <<<EOD
      <IfModule mod_headers.c>
      Header always set X-Content-Type-Options "nosniff"
      </IfModule>
      EOD;
    
      return $new_rule . $rules;
    }
    add_filter('mod_rewrite_rules', 'add_headers_htaccess');

You must log in before being able to contribute a note or feedback.