Htaccess Dosyası İle WordPress Hız Ve Güvenlik Optimizasyonu

X-Code

Uzman üye
19 Mar 2019
1,855
3
335
Localhost

jyo2qm.png

Merhaba TürkHackTeam Üyeleri.
Bu Konumda Sizlere Htaccess Dosyasını Düzenleyerek WordPress Sitemizde Hız Ve Güvenlik Optimizasyonu Yapmayı Göstereceğim.


dWHR1f.gif


rkIt1B.png


Htaccess Dosyasını Düzenleyerek WordPress Sitede Hız Ve Güvenlik Optimizasyonu Yapma

» Öncelikle sitemizin cPanel veya başka bir yönetim paneline giriyoruz. Ve panelimizde bulunan Dosya Yöneticisine giriyoruz.

8TgAoi.jpg


» Sonra burada .htaccess dosyasını buluyoruz.

uiMF6z.jpg


» Eğer .htaccess dosyası yoksa kendimiz bir tane .htaccess adında bir dosya oluşturuyoruz.

rkVTO0.jpg


» Hostingimizin bir yönetim paneli bulunmuyorsa aynı işlemleri ftp üzerinden de yapabiliriz.

0zhGdj.jpg


» Bu işlemlerden sonra .htaccess dosyasını düzenlemek için açıyoruz.

wLeyK0.jpg


» Ve aşağıda size verdiğim kodu .htaccess dosyasının en altına (içinde başka kodlarda varsa) yazıyoruz ve kaydedip çıkıyoruz.

UWDdpw.jpg


» Ve böylelikle WordPress sitemizde basit ddos saldırılarını, injection, spam bot ve yavaşlamaları bi nebzede olsa engellemiş oluyoruz. Bu kodlar sayesinde WordPress sitemiz hem daha hızlı hemde daha güvenli olmuş oluyor.


Kod:
[COLOR="White"]#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|****eye|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 "****URI" 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>[/COLOR]


rNH656.png



Konum Bu Kadardı Umarım Beğenmişinizdir Ve Faydalı Olmuştur.

Okuduğunuz İçin Teşekkür Ederim.
Esenlikle Kalın...

Saygılarımla:Smiley1021:


21AyCK.png

 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.