Bir yerde buldum ve sizlerle de paylaşmak istedim. Aşağıdaki kodları .htaccess dosyasına eklediğinizde sitenize ekstra güvenlik sağlamış oluyorsunuz.
# HOTLINK PROTECTION <ifModule mod_rewrite.c> RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} \\.(gif|jpe?g?|png)$ [NC] RewriteCond %{REQUEST_FILENAME} !/hotlink\\-(01|02).gif$ [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\\.)?example\\. [NC] # RewriteRule \\.(gif|jpe?g?|png)$ - [F,NC,L] RewriteRule \\.(gif|jpe?g?|png)$ http://example.com/wordpress/hotlink-02.gif [R,NC,L] </ifModule> # BLOCK EVIL REQUESTS <ifModule mod_rewrite.c> Options +FollowSymLinks RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) RewriteRule .* blacklist.php [F,L] </ifModule> # BLOCK SCUM REFERRERS <ifModule mod_rewrite.c> RewriteCond %{HTTP_REFERER} (.*)secondchanceranch(.*) [NC] RewriteRule .* - [F,L] </ifModule> # DENY ACCESS TO NO-REFERRER REQUESTS <ifModule mod_rewrite.c> RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .wp-comments-post\\. RewriteCond %{HTTP_REFERER} !.*example\\. [OR,NC] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule .* - [F,L] </ifModule> # REDIRECT URL (fafich.ufmg.br) <ifModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} .* RewriteCond %{HTTP_REFERER} ^https?://([^.]+\\.)?ufmg\\. [NC] RewriteRule .* - [F,L] </ifModule>
Kaynak: https://perishablepress.com/code-snippets/#code-snippets_htaccess
Yorumlar
Bu yazıya yorum yapan ilk kişi sen ol.