Documentation

wp-hide/mod_rewrite_rules

Posted in: Getting Started (4) Plugin Options Explained (33) Actions / Filters (27) How To (12)      Rewrite (18)  

Name: wp-hide/mod_rewrite_rules
Type: Filter
Arguments: $rules, $rewrite_server_software

The filter can be used to change, add or remove any generated rewrite rules, which are being saved within .htaccess file (for Apache) or web.config file (for IIS). The same rules are being listed within the Set-up interface, so any modification through this filter will show up for Setup accordingly.


    add_filter('wp-hide/mod_rewrite_rules', 'wp_hide__mod_rewrite_rules', 999, 2);
    function wp_hide__mod_rewrite_rules( $rules, $server_software )
        {
            
            if  ( $server_software !=   'apache' )
                return $rules;
                
            
            $rules  =   '#Pass-through if another rewrite rule has been previouslly applied'    .
                        "\n"    .   'RewriteCond %{ENV:REDIRECT_STATUS} 200'    .
                        "\n"    .   'RewriteRule ^ - [L]' . 
                        "\n\n"  .   $rules;
            
            return $rules;

        }
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Scroll to top