Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Kupası
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Belirli WordPress Dizinlerinde PHP Yürütme Nasıl Devre Dışı Bırakılır

Editoryal Not: WPBeginner üzerindeki ortak bağlantılardan komisyon kazanıyoruz. Komisyonlar, editörlerimizin görüşlerini veya değerlendirmelerini etkilemez. Editoryal Süreç hakkında daha fazla bilgi edinin.

WordPress sitenizin güvenliğini artırmak mı istiyorsunuz?

Bilgisayar korsanları web sitenize girmek için kötü amaçlı yazılım yükleyebilir. Bu dizinlerdeki PHP kodunu devre dışı bırakmak kötü amaçlı yazılımın çalışmasını durduracaktır.

Bu makalede, .htaccess dosyasını kullanarak WordPress’te PHP yürütmeyi nasıl devre dışı bırakacağınızı göstereceğiz.

How to Disable PHP Execution in Certain WordPress Directories

Neden Belirli WordPress Dizinlerinde PHP Çalıştırmayı Devre Dışı Bırakmalısınız?

WordPress varsayılan olarak belirli dizinleri yazılabilir hale getirir, böylece siz ve web sitenizdeki diğer yetkili kullanıcılar web sitenize kolayca tema, eklenti, resim ve video yükleyebilirsiniz.

Ancak bu özellik, WordPress web sitenize arka kapı erişim dosyaları veya kötü amaçlı yazılım yüklemek için kullanabilecek bilgisayar korsanları gibi yanlış ellere geçerse kötüye kullanılabilir.

Bu kötü amaçlı dosyalar genellikle temel WordPress dosyaları olarak gizlenir. Çoğunlukla PHP ile yazılırlar ve web sitenizin her yönüne tam erişim elde etmek için arka planda çalışabilirler.

Kulağa korkutucu geliyor, değil mi?

Endişelenmeyin. Bunun için kolay bir çözüm var. İhtiyacınız olmayan belirli dizinlerde PHP çalıştırmayı devre dışı bırakmanız yeterlidir. Bunu yaptığınızda, bu dizinlerin içinde hiçbir PHP dosyası çalışmayacaktır.

Şimdi .htaccess dosyasını kullanarak PHP yürütmesini devre dışı bırakarak WordPress güvenliğini nasıl artıracağımıza bir göz atalım.

.htaccess Dosyasını Kullanarak Belirli WordPress Dizinlerinde PHP Yürütmeyi Devre Dışı Bırakma

Çoğu WordPress sitesinin kök klasöründe bir .htaccess dosyası bulunur.

Bu güçlü yapılandırma dosyası, yönetici alanını parola ile korumak, dizin taramayı devre dışı bırakmak, SEO dostu bir URL yapısı oluşturmak ve daha fazlası için kullanılır.

Varsayılan olarak .htaccess dosyası WordPress web sitenizin kök klasöründe bulunur, ancak iç WordPress dizinlerinizin içinde ek .htaccess dosyaları oluşturabilir ve kullanabilirsiniz.

Web sitenizi arka kapı erişim dosyalarından korumak için bir .htaccess dosyası oluşturmanız ve bunu sitenizin /wp-includes ve /wp-content/uploads dizinlerine yüklemeniz gerekir.

Windows’ta Notepad veya Mac’te TextEdit gibi bir metin düzenleyici kullanarak bilgisayarınızda yeni bir dosya oluşturun. Dosyayı .htaccess olarak kaydedin ve aşağıdaki kod parçacığını içine yapıştırın:

<Files *.php>
deny from all
</Files>

Şimdi dosyayı bilgisayarınıza kaydedin.

Ardından, bu dosyayı WordPress barındırma sunucunuzdaki /wp-includes ve /wp-content/uploads klasörlerine yüklemeniz gerekir.

Bir FTP istemcisi veya hosting hesabınızın cPanel panosundaki Dosya Yöneticisi uygulamasını kullanarak yükleyebilirsiniz.

Upload htaccess file to your WordPress site

Yukarıdaki kodu içeren .htaccess dosyası eklendiğinde, bu dizinlerde herhangi bir PHP betiğinin çalışmasını durduracaktır.

Sucuri Kullanarak WordPress’te Arka Kapıları Kontrol Etme

Bu .htaccess hilesini kullanmak WordPress güvenliğinizi güçlendirmenize yardımcı olur, ancak zaten saldırıya uğramış bir WordPress sitesini düzeltmez.

Arka kapılar akıllıca gizlenir ve zaten göz önünde gizlenebilir.

Web sitenizdeki olası arka kapıları kontrol etmek istiyorsanız, web sitenizde Sucuri ‘yi etkinleştirmeniz gerekir.

Sucuri

Sucuri piyasadaki en iyi WordPress güvenlik eklentisidir. Web sitenizi olası tehditlere, şüpheli kodlara, kötü amaçlı yazılımlara ve güvenlik açıklarına karşı tarar.

Ayrıca, siteniz ile şüpheli trafik arasına bir güvenlik duvarı ekleyerek çoğu bilgisayar korsanlığı girişiminin web sitenize ulaşmasını bile etkili bir şekilde engeller.

En önemlisi, eğer WordPress siteniz saldırıya uğrarsa, bunu sizin için temizleyecektir. Daha fazla bilgi edinmek için Sucuri incelememizi okuyabilirsiniz çünkü biz yıllardır onların hizmetlerini kullanıyoruz.

Saldırıya uğramış bir WordPress sitesindeki arka kapıları bulma ve düzeltme hakkındaki kılavuzumuzda daha fazla bilgi edinebilirsiniz.

WordPress Güvenliğinin Nasıl Geliştirileceğine Dair Uzman Kılavuzları

Artık belirli dizinlerde PHP çalıştırmayı devre dışı bırakarak WordPress güvenliğinizi nasıl artıracağınızı bildiğinize göre, diğer bazı güvenlik tekniklerini öğrenmek isteyebilirsiniz.

WordPress güvenliğini artırmaya yönelik en iyi kılavuzlarımızdan bazılarını burada bulabilirsiniz:

Umarız bu makale, web sitenizin güvenliğini artırmak için belirli WordPress dizinlerinde PHP yürütmeyi nasıl devre dışı bırakacağınızı öğrenmenize yardımcı olmuştur. Ayrıca ücretsiz bir iş e-posta adresinin nasıl oluşturulacağını öğrenmek veya sitenizi büyütmek için sahip olunması gereken WordPress eklentileri için uzman seçimlerimizi görmek isteyebilirsiniz.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Açıklama: İçeriğimiz okuyucu desteklidir. Bu, bazı bağlantılarımıza tıklarsanız komisyon kazanabileceğimiz anlamına gelir. WPBeginner'ın nasıl finanse edildiğini, neden önemli olduğunu ve nasıl destek olabileceğinizi görün. İşte editoryal sürecimiz.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Ultimate WordPress Araç Kiti

Araç setimize ÜCRETSİZ erişim sağlayın - her profesyonelin sahip olması gereken WordPress ile ilgili ürün ve kaynaklardan oluşan bir koleksiyon!

Reader Interactions

40 yorumBir Cevap Bırakın

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Mrteesurez says

    I see this as a great form of securing a website by disabling PHP execution in folders. According to this article, only two directories are secured, what of others ? Have they secured naturally or hackers don’t need it during the attempt ?

    • WPBeginner Support says

      Other sections of your site’s files normally require stricter access or have php files that are required to work for your site to work.

      Yönetici

  3. Jiří Vaněk says

    Thanks for these safety tips. I have created an htaccess file and will upload it to FTP. I have a website on my own server, so the question of security is entirely up to me. Thanks for the next step in making my WordPress a little more secure again.

  4. Unarine Leo Netshifhefhe says

    I also have this alert on my Updraft plugin where backups are not happening can this be due to htaccess?

    “Backup directory could not be created…

    The folder exists, but your webserver does not have permission to write to it. You will need to consult with your web hosting provider to find out how to set permissions for a WordPress plugin to write to the directory. (wp-content/updraft)”

  5. Brian Prom says

    FYI: you have a typo in your code snippet for the .htaccess snippet.

    Using your code snippet as is (without the closing /) breaks image loading.

  6. Vitor Gonçlaves says

    I’ve found some .php files in the uploads folder created by plugins. Can I assume this won’t cause a problem, or do I have to analyse each plugin individually?

  7. Suman Samanta says

    Great writing! You have a flair for informational writing. Your content has impressed me beyond words. I have a lot of admiration for your writing. Thank you for all your valuable input on this topic.

    • WPBeginner Support says

      Hey Thato,

      You can download your .htaccess file to your computer as a backup and then delete it from your website. Go to WordPress admin area Settings » Permalinks and click on the save changes button. This should regenerate your .htaccess file.

      Yönetici

  8. Shawn Rebelo says

    Do not do wp-content.
    Do wp-content/uploads.

    And this:

    order allow,deny
    deny from all

    May very on servers.

  9. Hardik says

    Does it affect the uploads file to upload on webpages?
    I found that after uploading this htaccess file to the folder many of images from many posts are not displaying.

  10. Chuck Cochems says

    Yeah, denying access to php files in the includes directory breaks the site because including actually obeys .htaccess restrictions.

    But the restriction on the uploads directory is very smart, and this should be there .BY DEFAULT in the uploads directory, and there’s no good reason for it not to be present.

  11. KOnnie says

    ZOMG! can’t you just disable write access to /wp-includes folder?
    Why fight with consequences when you can prevent the cause?

  12. Jeff Wigal says

    You can also put this in your Apache virtualhost, which will accomplish the same thing:

    Order allow,deny
    Deny from all

  13. anton says

    how to implement this code if we have combination of lower case and upper case on file extention for example on.php on my website its work but it s not working if the file named with.PHp ,.PHP .PhP or combination of them,the backdoor script still executed

    Thank you

  14. Shams says

    Hi Syed,
    Thanks for such an informative post and in fact it provides a great solution for saving WordPress from hackers.

  15. Ramon says

    I created an .htaccess file in the wp-includes folder. Site looked oke but my WYSIWYG editor in the admin pages wasn’t working. Had to remove the .htaccess file again. (WP 3.9.1)

  16. Wes says

    I also found my wp-includes folder full of php files and I can’t see how using that .htaccess file in there wouldn’t break something. I did use it in the uploads dir.

  17. Red says

    forgive my bad english…
    i followed all your instructions in this article, but when i go my dashboard to add a newpost, my post section was messed up. … i suspect the .htaccess was the problem.
    when i deleted it, the post was fine.

  18. Brad says

    I tried this in my /wp-includes/ directory, which is full of php files. Of course I could no longer access the site. Did you really mean to include the includes directory for use with the .htaccess file?

    Did you maybe mean /wp-includes/images ?

    • Editorial Staff says

      Nope. We meant /wp-includes/ folder. We have this on our wp-includes folder. If for some reason it is breaking your site, then delete the .htaccess file from your wp-includes folder.

      Yönetici

      • Brad says

        Strange, my wp-includes folder has over 90 php files in it. And it does break the site. I took it back out immediately.

        But I did put it in the /wp-content/uploads/ folder and its works just fine there. Thanks for responding

        • Alfred says

          Putting an htaccess file denying access to php files in a directory full of php files does seem rather odd. I assume it’s because these files are normally only included, not executed directly. If that’s true, wouldn’t it be better to just deny access to the entire directory?

Bir Cevap Bırakın

Yorum bırakmayı seçtiğiniz için teşekkür ederiz. Lütfen tüm yorumların yorum poli̇ti̇kasi uyarınca denetlendiğini ve e-posta adresinizin yayımlanmayacağını unutmayın. Ad alanında anahtar kelime KULLANMAYIN. Kişisel ve anlamlı bir sohbet edelim.