WordPress’te dizin taramayı devre dışı bırakmak mı istiyorsunuz?
Dizin taraması, sitenizin eklentilerindeki, temalarındaki ve hatta barındırma sunucunuzdaki güvenlik açıklarından yararlanmak için kullanılabilecek önemli bilgileri bilgisayar korsanlarına göstererek sitenizi riske atabilir.
Bu makalede, WordPress’te dizin taramayı nasıl devre dışı bırakabileceğinizi göstereceğiz.
WordPress’te Dizin Taramayı Devre Dışı Bırakmak Ne İşe Yarar?
Birisi web sitenizi her ziyaret ettiğinde, web sunucunuz bu isteği işleyecektir.
Genellikle sunucu, ziyaretçinin tarayıcısına index.html gibi bir dizin dosyası gönderir. Ancak, sunucu bir dizin dosyası bulamazsa, bunun yerine istenen dizindeki tüm dosya ve klasörleri gösterebilir.
Buna dizin tarama denir ve genellikle barındırma sunucunuzda varsayılan olarak etkinleştirilir.
Daha önce bir siteyi ziyaret ettiyseniz ve bir web sayfası yerine dosya ve klasörlerin bir listesini gördüyseniz, dizin taramayı iş başında görmüşsünüz demektir.
Sorun şu ki, bilgisayar korsanları kullandığınız tüm temalar ve eklentiler de dahil olmak üzere web sitenizi oluşturan dosyaları görmek için dizin taramayı kullanabilir.
Bu temalardan veya eklentilerden herhangi birinin bilinen güvenlik açıkları varsa, bilgisayar korsanları bu bilgiyi WordPress blogunuzun veya web sitenizin kontrolünü ele geçirmek, verilerinizi çalmak veya başka eylemler gerçekleştirmek için kullanabilir.
Saldırganlar ayrıca dosya ve klasörlerinizin içindeki gizli bilgilere bakmak için dizin taramayı da kullanabilir. Hatta e-kitap indirmeleri veya çevrimiçi kurslar gibi genellikle ücretlendirdiğiniz içerikler de dahil olmak üzere web sitenizin içeriğini kopyalayabilirler.
Bu nedenle WordPress’te dizin taramayı devre dışı bırakmak en iyi uygulama olarak kabul edilir.
WordPress’te Dizin Taramanın Etkin Olup Olmadığı Nasıl Kontrol Edilir?
WordPress web siteniz için dizin taramanın şu anda etkin olup olmadığını kontrol etmenin en kolay yolu, /wp-includes/ klasör bağlantısını şu şekilde ziyaret etmektir: https://example.com/wp-includes/.
www.example.com adresini web sitenizin URL’si ile değiştirmek isteyeceksiniz.
403 Yasak veya benzeri bir mesaj alırsanız, WordPress web sitenizde dizin taraması zaten devre dışı bırakılmış demektir.
Bunun yerine bir dosya ve klasör listesi görürseniz, bu web siteniz için dizin taramanın etkinleştirildiği anlamına gelir.
Bu, web sitenizi saldırılara karşı daha savunmasız hale getirdiğinden, genellikle WordPress’te dizin taramasını engellemek istersiniz.
WordPress’te Dizin Tarama Nasıl Devre Dışı Bırakılır
Dizin listelemeyi devre dışı bırakmak için sitenizin .htaccess dosyasına bazı kodlar eklemeniz gerekir.
Dosyaya erişmek için bir FTP istemcisine ihtiyacınız olacak veya WordPress hosting kontrol panelinizdeki dosya yöneticisi uygulamasını kullanabilirsiniz.
FTP’yi ilk kez kullanıyorsanız, FTP kullanarak sitenize nasıl bağlanacağınıza ilişkin eksiksiz kılavuzumuza bakabilirsiniz.
Sitenize bağlandıktan sonra, web sitenizin ‘public’ klasörünü açın ve .htaccess dosyasını bulun. .htaccess dosyasını masaüstünüze indirerek ve ardından Not Defteri gibi bir metin düzenleyicide açarak düzenleyebilirsiniz.
Dosyanın en altına aşağıdaki kodu eklemeniz yeterlidir:
Options -Indexes
Şuna benzer bir şey olacak:
İşiniz bittiğinde, .htaccess dosyanızı kaydedin ve bir FTP istemcisi kullanarak sunucunuza geri yükleyin.
İşte bu kadar. Şimdi aynı http://example.com/wp-includes/ URL’sini ziyaret ederseniz, 403 Forbidden veya benzer bir mesaj alırsınız.
Uzman İpucu: WordPress web sitenizin saldırıya uğramış olabileceğinden şüpheleniyorsanız, saldırıya uğramış bir WordPress web sitesini düzeltme kılavuzumuza bakın. Alternatif olarak, profesyonel saldırıya uğramış WordPress sitesi onarım hizmetimize göz atabilir ve web sitenizi temizlemek için profesyonel WordPress güvenlik uzmanları kiralayabilirsiniz.
Umarız bu makale WordPress’te dizin taramayı nasıl devre dışı bırakacağınızı öğrenmenize yardımcı olmuştur. Ayrıca nihai WordPress güvenlik kılavuzumuzu veya en iyi WordPress güvenlik eklentileri uzman seçimimizi 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.
Dennis Muthomi
I noticed that I have directory browsing disabled on my WordPress site, because I got a 403 error when trying to access wp-includes, yet I don’t remember ever having edited my .htaccess file to do so.
Does WordPress automatically disable directory browsing during initial installation?
WPBeginner Support
Unless there was a recent change it does not by default, it may be your hosting provider’s default settings for htaccess.
Yönetici
Dayo Olobayo
I didn’t even know that this vulnerability existed. Just checked mine and got the 403 error. which means directory browsing is disabled. Thank you.
WPBeginner Support
You’re welcome
Yönetici
Jiří Vaněk
Thanks for the advice. On directory browsing, or that I have it enabled, the AIO SEO plugin keeps warning me. I have currently solved the problem by making the folders have an index file that is empty. Is it possible to take this as one of the possible solutions?
WPBeginner Support
You can try that method but we would still recommend the htaccess method from our guide.
Yönetici
Jiří Vaněk
Thanks for the advice, I finally used the Options -Indexes method now and AIO SEO already reports the problem as solved. Thanks again.
Ka Khaliq
After editing the htaccess file as per the provided guidelines, I do see 403 Forbidden message for /wp-includes/. But I’m unable to see edit any post. Upon editing a post, I see the same 403 Forbidden message. How to solve this?
WPBeginner Support
There may be an issue with your file permissions, we would recommend taking a look at our guide below for fixing your permissions:
https://www.wpbeginner.com/wp-tutorials/how-to-fix-the-403-forbidden-error-in-wordpress/
Yönetici
Ka Khaliq
The issue resolved after clearing the web history/cache.
Thanks for your time.
Dina D
Thank you so much! Clear, concise, and easy to follow. Thank you so much!
WPBeginner Support
You’re welcome!
Yönetici
Rabee Khan
Thank You… precise and easy to understand!
WPBeginner Support
Glad our guide was helpful!
Yönetici
Kimmy
Thanks for the two-word solution! Lol. Worked perfectly!
WPBeginner Support
Glad we could help!
Yönetici
Seashell
I was shocked to see the folders accessible right in the browser.
Thanks for your solution!
WPBeginner Support
Glad we could help!
Yönetici
Deepak Kumar
Its work like charm. Article on wpbeginners like ready to go solution. Keep it up.
Ayo
How do I now solve the 404 error that comes after?
Pradip Singh
I am in love with this website. Every day I am surprised when I read a new article from this website. Thankfully I read this article today and immediately I implemented the advice.
WPBeginner Support
Glad you found our content helpful
Yönetici
Sourabh
Will it block CDNs from accessing my website for static content?
WPBeginner Support
No, it will not.
Yönetici
sami
Does this method affect google crawling .. is it SEO friendly?
WPBeginner Support
It should not affect search engines crawling your site.
Yönetici
Meera Shaikh
Thanks its Done
WPBeginner Support
You’re welcome
Yönetici
Pradeep
Thanks my friend, I just try this and it’s work.
You are the genius.
WPBeginner Support
Glad our guide was helpful
Yönetici
mousam
Thank you. I applied and it worked.
You guys are the best source for learning wordpress.
WPBeginner Support
You’re welcome, glad our guide was helpful
Yönetici
Kevine
Thank you very much for this. It solved my problem.
Thanks again.
WPBeginner Support
You’re welcome, glad our guide was helpful
Yönetici
malika
Thank you for sharing information!
WPBeginner Support
You’re welcome
Yönetici
Jonthan
So is it ok to have this code on .htaccess file even when an index.php file is present in the root folder.
Kindly respond.
WPBeginner Support
Yes
Yönetici
Teresa Cuervo
Do you need Filezila to do this or can you go to the FTP via Cpanel and do this?
Thank you
WPBeginner Support
You can use either, not all hosts have a file manager is why we show Filezilla
Yönetici
michael
Hello
does this action affect pages indexing on search engines?
and does it make some problems for indexed pages of my WordPress website?
Thanks
WPBeginner Support
No, it would not affect that negatively.
Yönetici
Rhen Castrodes
Thank you. it works
WPBeginner Support
Glad our recommendation was able to help you
Yönetici
John
Thank you! It works even now in 2020.
WPBeginner Support
You’re welcome
Yönetici
Shams
Amazing post,
Just have simple question, I added this code and it’s working, the question is Google indexes those page e.g sitecom/wp-contents/2019/2, will Google remove those pages automatically now as these are 404. Or I should remove it in Search Console?
Thanks
WPBeginner Support
This code should not make your direct links to images and files turn into 404s
Yönetici
Bill
Hello!
I recently applied this rule
and at the same day the front page of my blog
got vanished from google index.
Do you see any connection?
WPBeginner Support
Adding this to your htaccess should not affect your indexing, there are multiple reasons and you would want to check your Google Search Console for what it says about your home page.
Yönetici
Ionel G
Thanks for all the tips that you provide!
I am still wondering how can you hide the wp-content & wp-include folder from sources? I hate it when someone goes right click and source it can see all of my plugins :). Do you have any script for this?
Thank you in advance!
WPBeginner Support
We do not have a recommended method for that at the moment, the most common reason you can’t see those folders in dev tools is a site’s cache.
Yönetici
Mayur
Could you please tell me How can i disable WordPress in sub folder like my WordPress install on [www.mydomain.com] and i want to disable wordpress in [www.mydomain.com/customscript]
WPBeginner Support
You may want to first take a look at creating a custom page template: https://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/
Otherwise, you would need to create a folder with that name and inside that folder add an index.html file for a nonWordPress page to appear.
Yönetici
Rafael
Thank you. Worked perfectly for all browsers.
Dipankar
but wp-content is showing . how to remove it as well.
Deatram
I disabled directory browsing, but still someone can see my directory when they use developer tools in chrome browser. How do I disable in that as well?
Faeze
I added the line that you said in .htaccess but it showes my directories yet .
What should I do now??
Nathan
When I click “Save Changes” on the Permalink Settings page the .htaccess file is updated, erasing the “Options -Indexes” code that I inputted. The code works fine, but I am concerned I will unknowingly delete it while performing some other task. Are there any other dashboard settings changes that I should know about that may affect the .htaccess file and erase the code? Thanks
Tôi Sống
Awesome, it work very good!
Baggio
Huge fan of wpbeginner, Optin Monster – I got so many useful tips and tricks on WP – and I have to say, the site design is just brilliant. And of course, the content here is epicly useful.
Thanks guys!
daniel
Hey! It doesnt seem to work. if i pull an image to another page its opened with a link of: example.com/wp-content/uploads/…
Any idea? thanks!
WPBeginner Support
Hey Daniel,
Your images and files inside directories can still be directly accessed. However, server will not let someone directly browse a directory and see its contents.
Yönetici
Axel Jebens
I would appreciate if you could iterate on this. I had a hard time when trying to get a solution for this issue. There are some ideas based on a htaccess redirecting to a php file that first checks if the user is logged on. Is there any plugin which provides such a function?
Ünal Hoca
Thank you
Khalid Mahmud
Thank you. It’s working…….
Kim
Sorry to late ask. I want to know, are these techniques safe to use regarding SEO score ? Hope you answer !
WPBeginner Support
Yes, they are.
Yönetici
Kimmy
Still works pretty well. Awesome, simple, and working. Thanks!
Charles
I have been writing this same code for weeks now but my directory remains visible to users. Pls what am doing wrong? Or could it be that my site is still loading from cached contents? Everybody says it is working but my own experience is different. Any help will be appreciated! Thanks in anticipation of your reply.
Kimmy
What part are you having trouble on? What is your hosting provider btw?
Lily
Thank you. Worked like a charm!
Prakash
This Above Trick Is Not Working Man….
Mike
Is there a way to allow viewing a directory but just hide the Parent Directory link for a specific page? This would be a network share folder that multiple people would access, and have sub folders which would still require a parent directory listing. I just don’t want anyone going above the shared folder.
Christian Nastari
This didn’t work for me. I tried before and after #END WordPress and didn’t work. I also tried “Options All -Indexes”, but didn’t work either
hrwhisper
very helpful, thank you very much
nitai
Really great. today I just faced and thinking how can I disallow like joomla and I found the exact solution.
Rob Myrick
This was very helpful and quick – thank you
Anita in SD
Thanks so much, was dismayed to see images from my site going to a parent directory :0. This was very helpful and worked well.
Blessings – A
Heather Jacobsen
Thanks for this tutorial. It worked great for hiding my uploads from anyone just wanting to browse that directory. One question, though. Does this by chance turn off the ability of search engines to browse my website. Sorry if it seems like a dumb question. I am a newbie, after all.
Wasil Burki
I added the Options -Indexes code to the htaccess file, however now I am not able to access the site I get a 503 error. Am I doing something wrong? Need help bad!! Thanks