wc_ms_protect_download_rewite_rules()
Protect downloads from ms-files.php in multisite.
No Hooks.
Return
String
.
Usage
wc_ms_protect_download_rewite_rules( $rewrite );
- $rewrite(string) (required)
- rewrite rules.
wc_ms_protect_download_rewite_rules() wc ms protect download rewite rules code WC 7.7.0
function wc_ms_protect_download_rewite_rules( $rewrite ) { if ( ! is_multisite() || 'redirect' === get_option( 'woocommerce_file_download_method' ) ) { return $rewrite; } $rule = "\n# WooCommerce Rules - Protect Files from ms-files.php\n\n"; $rule .= "<IfModule mod_rewrite.c>\n"; $rule .= "RewriteEngine On\n"; $rule .= "RewriteCond %{QUERY_STRING} file=woocommerce_uploads/ [NC]\n"; $rule .= "RewriteRule /ms-files.php$ - [F]\n"; $rule .= "</IfModule>\n\n"; return $rule . $rewrite; }