static function prevent_image_hotlinks() { global $aio_wp_security; $rules = ''; if ($aio_wp_security->configs->get_value('aiowps_prevent_hotlinking') == '1') { $url_string = AIOWPSecurity_Utility_Htaccess::return_regularized_url(AIOWPSEC_WP_URL); if ($url_string == FALSE) { $url_string = AIOWPSEC_WP_URL; } $rules .= AIOWPSecurity_Utility_Htaccess::$prevent_image_hotlinks_marker_start . PHP_EOL; //Add feature marker start $rules .= '<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_REFERER} !^$' . PHP_EOL; $rules .= ' RewriteCond %{REQUEST_FILENAME} -f' . PHP_EOL; $rules .= ' RewriteCond %{REQUEST_FILENAME} \\.(gif|jpe?g?|png)$ [NC]' . PHP_EOL; $rules .= ' RewriteCond %{HTTP_REFERER} !^' . $url_string . ' [NC]' . PHP_EOL; $rules .= ' RewriteRule \\.(gif|jpe?g?|png)$ - [F,NC,L] </IfModule>' . PHP_EOL; $rules .= AIOWPSecurity_Utility_Htaccess::$prevent_image_hotlinks_marker_end . PHP_EOL; //Add feature marker end } return $rules; }