WordPress sitelerinde genellikle yaşanan sorunlardan bazıları basit ddos saldırılar, injection, spam bot ve yavaşlamalardır. Bu makalemizdeki htaccess içeriğini kullanarak wordpress sitenizi hem daha güvenli hale getirecek, hemde hızlandırmış olacaksınız.
Aşağıdaki .htaccess içeriğini /public_html/.htaccess dosyanızı açarak en alta ekleyebilirsiniz ;
- Bilgi : işlem öncesi .htaccess dosyanızın yedeğini alınız. Eğer çakışma sorunları yaşarsanız son eklediğiniz kuralları kaldırınız.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
#Referer ddos engelliyoruz RewriteCond %{QUERY_STRING} ^([0-9]+)$ [NC,OR] RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+)(.*)$ [NC,OR] RewriteCond %{QUERY_STRING} ^([0-9]+\.[0-9])(.*)$ [NC,OR] RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+\.[0-9])(.*)$ [NC] RewriteRule ^(.*)$ %{HTTP_REFERER} [L] RewriteCond %{QUERY_STRING} ^ptrxcz.*$ RewriteCond% {QUERY_STRING}!^Ptrxcz.* $ RewriteRule (.*) - [F] #XmlRPC güvenliği artırıyoruz RewriteRule ^xmlrpc\.php$ "http\:\/\/0\.0\.0\.0\/" [R=301,L] #Belirli spam botları engelliyoruz RewriteCond %{HTTP:User-Agent} RewriteCond %{HTTP_USER_AGENT} ^(aesop_com_spiderman|alexibot|backweb|bandit|batchftp|bigfoot) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|markwatch) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(mata.?hari|memo|microsoft.?url|midown.?tool|miixpc|mirror|missigua) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(mister.?pix|moget|mozilla.?newt|nameprotect|navroad|backdoorbot|nearsite) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(net.?vampire|netants|netcraft|netmechanic|netspider|nextgensearchbot) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(attach|nicerspro|nimblecrawler|npbot|octopus|offline.?explorer) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(offline.?navigator|openfind|outfoxbot|pagegrabber|papa|pavuk) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebwalker) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(psbot|pump|queryn|recorder|realdownload|reaper|reget|true_robot) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|smartdownload) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqworm|superbot) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(superhttp|surfbot|asterias|suzuran|szukacz|takeout|teleport) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(telesoft|the.?intraformant|thenomad|tighttwatbot|titan|urldispatcher) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(turingos|turnitinbot|urly.?warning|vacuum|vci|voideye|whacker) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyborg|anonymouse) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|reaper|sauger|site.?quester|whack) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^.*(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures).*$ [NC] RewriteRule . - [F,L] </IfModule> #Sunucu cache deniyoruz <IfModule mod_cache.c> <IfModule mod_mem_cache.c> CacheEnable mem / MCacheSize 4096 MCacheMaxObjectCount 100 MCacheMinObjectSize 1 MCacheMaxObjectSize 2048 </IfModule> </IfModule> #DEFLATE kullanıyoruz <IfModule mod_deflate.c> <FilesMatch "\.(html|php|txt|xml|js|css|png|jpg|jpeg)$"> SetOutputFilter DEFLATE </FilesMatch> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html Header append Vary User-Agent env=!dont-vary </IfModule> #GZIP ile sıkıştırıyoruz <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html Header append Vary User-Agent env=!dont-vary </IfModule> # PHP5 ile sıkıştırma deniyoruz <IfModule mod_php5.c> php_value zlib.output_compression 16386 </IfModule> # Bazı zararlı botları engelliyoruz SetEnvIfNoCase User-Agent "AhrefsBot" bad_bots SetEnvIfNoCase User-Agent "AITCSRobot" bad_bots SetEnvIfNoCase User-Agent "Alexibot" bad_bots SetEnvIfNoCase User-Agent "Arachnophilia" bad_bots SetEnvIfNoCase User-Agent "archive\.org\_bot" bad_bots SetEnvIfNoCase User-Agent "ASpider" bad_bots SetEnvIfNoCase User-Agent "BackDoorBot" bad_bots SetEnvIfNoCase User-Agent "BSpider" bad_bots SetEnvIfNoCase User-Agent "CFNetwork" bad_bots SetEnvIfNoCase User-Agent "CyberPatrol" bad_bots SetEnvIfNoCase User-Agent "DeuSu" bad_bots SetEnvIfNoCase User-Agent "DotBot" bad_bots SetEnvIfNoCase User-Agent "EmailCollector" bad_bots SetEnvIfNoCase User-Agent "Exabot" bad_bots SetEnvIfNoCase User-Agent "FeedlyBot" bad_bots SetEnvIfNoCase User-Agent "Genieo" bad_bots SetEnvIfNoCase User-Agent "Gluten\ Free\ Crawler" bad_bots SetEnvIfNoCase User-Agent "GrapeshotCrawler" bad_bots SetEnvIfNoCase User-Agent "MaxPointCrawler" bad_bots SetEnvIfNoCase User-Agent "meanpathbot" bad_bots SetEnvIfNoCase User-Agent "MJ12bot" bad_bots SetEnvIfNoCase User-Agent "PagesInventory" bad_bots SetEnvIfNoCase User-Agent "Plukkie" bad_bots SetEnvIfNoCase User-Agent "Qwantify" bad_bots SetEnvIfNoCase User-Agent "SemrushBot" bad_bots SetEnvIfNoCase User-Agent "SentiBot" bad_bots SetEnvIfNoCase User-Agent "SEOkicks\-Robot" bad_bots SetEnvIfNoCase User-Agent "SeznamBot" bad_bots SetEnvIfNoCase User-Agent "spbot" bad_bots SetEnvIfNoCase User-Agent "WeSEE\_Bot" bad_bots SetEnvIfNoCase User-Agent "Wget" bad_bots SetEnvIfNoCase User-Agent "worldwebheritage\.org" bad_bots SetEnvIfNoCase User-Agent "Xenu\ Link\ Sleuth" bad_bots SetEnvIfNoCase User-Agent "Yahoo!\ Slurp" bad_bots SetEnvIfNoCase User-Agent "Zeus" bad_bots SetEnvIfNoCase User-Agent "facebookexternalhit" bad_bot SetEnvIfNoCase User-Agent "Twitterbot" bad_bot SetEnvIfNoCase User-Agent "MetaURI" bad_bot SetEnvIfNoCase User-Agent "mediawords" bad_bot SetEnvIfNoCase User-Agent "FlipboardProxy" bad_bot <Limit GET POST HEAD> Order Allow,Deny Allow from all Deny from env=bad_bots </Limit> #injection amaçlı kullanılan bazı dosyaları engelliyoruz <files wp-config.php> order allow,deny deny from all </files> <files wp-load.php> order allow,deny deny from all </files> <Files xmlrpc.php> Order allow,deny Deny from all </Files> |
WordPress uyumlu hostingler için WordPress Hosting sayfamızı ziyaret edebilirsiniz.