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

Deaktivieren des Directory Browsing in WordPress

Möchten Sie das Durchsuchen von Verzeichnissen in WordPress deaktivieren?

Das Durchsuchen von Verzeichnissen kann Ihre Website gefährden, da wichtige Informationen an Hacker weitergegeben werden, die dazu genutzt werden können, Schwachstellen in den Plugins, Themes oder sogar im Server Ihrer Website auszunutzen.

In diesem Artikel zeigen wir Ihnen, wie Sie das Durchsuchen von Verzeichnissen in WordPress deaktivieren können.

How to disable directory browsing in WordPress

Was bewirkt das Deaktivieren des Browsing von Verzeichnissen in WordPress?

Jedes Mal, wenn jemand Ihre Website besucht, wird Ihr Webserver diese Anfrage verarbeiten.

Normalerweise liefert der Server eine Indexdatei an den Browser des Besuchers, z. B. index.html. Wenn der Server jedoch keine Indexdatei finden kann, zeigt er stattdessen alle Dateien und Ordner im angeforderten Verzeichnis an.

Dies wird als Verzeichnis-Browsing bezeichnet und ist oft standardmäßig auf Ihrem Hosting Server aktiviert.

Wenn Sie schon einmal eine Website besucht haben und statt einer Webseite eine Liste von Dateien und Ordnern gesehen haben, dann haben Sie das Verzeichnis-Browsing in Aktion gesehen.

A WordPress site with directory browsing enabled

Das Problem ist, dass Hacker durch das Durchsuchen von Verzeichnissen die Dateien sehen können, aus denen Ihre Website besteht, einschließlich aller Themes und Plugins, die Sie verwenden.

Wenn eines dieser Themes oder Plugins bekannte Sicherheitslücken aufweist, können Hacker dieses Wissen nutzen, um die Kontrolle über Ihren WordPress-Blog oder Ihre Website zu übernehmen, Ihre Daten zu stehlen oder andere Aktionen durchzuführen.

Angreifer können auch das Durchsuchen von Verzeichnissen nutzen, um die vertraulichen Informationen in Ihren Dateien und Ordnern einzusehen. Sie könnten sogar die Inhalte Ihrer Website kopieren, einschließlich der Inhalte, für die Sie normalerweise Gebühren erheben würden, wie z. B. Downloads von E-Books oder Online-Kurse.

Aus diesem Grund gilt es als bewährte Praxis, das Durchsuchen von Verzeichnissen in WordPress zu deaktivieren.

Wie prüft man, ob das Browsen in Verzeichnissen in WordPress aktiviert ist?

Am einfachsten können Sie überprüfen, ob das Durchsuchen von Verzeichnissen für Ihre WordPress-Website aktiviert ist, indem Sie einfach den Link zum Ordner /wp-includes/ wie folgt aufrufen: https://example.com/wp-includes/.

Sie müssen www.example.com durch die URL Ihrer Website ersetzen.

Wenn Sie eine 403 Forbidden oder eine ähnliche Meldung erhalten, ist das Browsen im Verzeichnis auf Ihrer WordPress-Website bereits deaktiviert.

A website with directory browsing disabled

Wenn Sie stattdessen eine Liste von Dateien und Ordnern sehen, bedeutet dies, dass das Durchsuchen von Verzeichnissen für Ihre Website aktiviert ist.

A WordPress site with directory browsing enabled

Da dies Ihre Website anfälliger für Angriffe macht, sollten Sie in der Regel das Durchsuchen von Verzeichnissen in WordPress blockieren.

Deaktivieren des Browsens in Verzeichnissen in WordPress

Um das Auflisten von Verzeichnissen zu deaktivieren, müssen Sie einen Code in die .htaccess-Datei Ihrer Website einfügen.

Für den Zugriff auf die Datei benötigen Sie einen FTP-Client, oder Sie können die Dateimanager-App in Ihrem WordPress-Hosting-Control-Panel verwenden.

Wenn Sie FTP zum ersten Mal verwenden, lesen Sie bitte unsere vollständige Anleitung, wie Sie sich mit Ihrer Website per FTP verbinden.

Nachdem Sie sich mit Ihrer Website verbunden haben, öffnen Sie einfach den „öffentlichen“ Ordner Ihrer Website und suchen Sie die .htaccess-Datei. Sie können die .htaccess-Datei bearbeiten, indem Sie sie auf Ihren Desktop herunterladen und dann in einem Texteditor wie Notepad öffnen.

Fügen Sie ganz unten in der Datei einfach den folgenden Code ein:

Options -Indexes

Sie wird in etwa so aussehen:

The WordPress .htaccess file

Wenn Sie fertig sind, speichern Sie Ihre .htaccess-Datei und laden Sie sie mit einem FTP-Client zurück auf Ihren Server.

Das war’s. Wenn Sie nun dieselbe URL http://example.com/wp-includes/ besuchen, erhalten Sie eine 403 Forbidden oder eine ähnliche Meldung.

How to disable directory browsing in WordPress

Expertentipp: Wenn Sie vermuten, dass Ihre WordPress-Website gehackt wurde, lesen Sie unseren Leitfaden zur Behebung einer gehackten WordPress-Website. Alternativ können Sie unseren professionellen Dienst zur Reparatur gehackter WordPress-Websites in Anspruch nehmen und professionelle WordPress-Sicherheitsexperten mit der Bereinigung Ihrer Website beauftragen.

Wir hoffen, dass dieser Artikel Ihnen geholfen hat zu erfahren, wie Sie das Durchsuchen von Verzeichnissen in WordPress deaktivieren können. Vielleicht interessieren Sie sich auch für unseren ultimativen WordPress-Sicherheitsleitfaden oder unsere Expertenauswahl der besten WordPress-Sicherheits-Plugins.

Wenn Ihnen dieser Artikel gefallen hat, dann abonnieren Sie bitte unseren YouTube-Kanal für WordPress-Videotutorials. Sie können uns auch auf Twitter und Facebook finden.

Offenlegung: Unsere Inhalte werden von unseren Lesern unterstützt. Das bedeutet, dass wir möglicherweise eine Provision verdienen, wenn Sie auf einige unserer Links klicken. Mehr dazu erfahren Sie unter Wie WPBeginner finanziert wird , warum das wichtig ist und wie Sie uns unterstützen können. Hier finden Sie unseren redaktionellen Prozess .

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.

Das ultimative WordPress Toolkit

Erhalte KOSTENLOSEN Zugang zu unserem Toolkit - eine Sammlung von WordPress-bezogenen Produkten und Ressourcen, die jeder Profi haben sollte!

Reader Interactions

94 KommentareEine Antwort hinterlassen

  1. Syed Balkhi

    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. Deepak Kumar

    Its work like charm. Article on wpbeginners like ready to go solution. Keep it up.

  3. Ayo

    How do I now solve the 404 error that comes after?

  4. 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 :)

      Admin

  5. Sourabh

    Will it block CDNs from accessing my website for static content?

    • WPBeginner Support

      No, it will not.

      Admin

  6. sami

    Does this method affect google crawling .. is it SEO friendly?

    • WPBeginner Support

      It should not affect search engines crawling your site.

      Admin

    • WPBeginner Support

      You’re welcome :)

      Admin

  7. Pradeep

    Thanks my friend, I just try this and it’s work.
    You are the genius.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  8. 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 :)

      Admin

  9. Kevine

    Thank you very much for this. It solved my problem.

    Thanks again.

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  10. malika

    Thank you for sharing information!

    • WPBeginner Support

      You’re welcome :)

      Admin

  11. 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.

  12. 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 :)

      Admin

  13. 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.

      Admin

  14. Rhen Castrodes

    Thank you. it works

    • WPBeginner Support

      Glad our recommendation was able to help you :)

      Admin

  15. John

    Thank you! It works even now in 2020.

    • WPBeginner Support

      You’re welcome :)

      Admin

  16. 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

      Admin

  17. 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.

      Admin

  18. 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.

      Admin

  19. 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]

  20. Rafael

    Thank you. Worked perfectly for all browsers.

  21. Dipankar

    but wp-content is showing . how to remove it as well.

  22. 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?

  23. Faeze

    I added the line that you said in .htaccess but it showes my directories yet .
    What should I do now??

  24. 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

  25. Tôi Sống

    Awesome, it work very good!

  26. 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!

  27. 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.

      Admin

      • 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?

  28. Khalid Mahmud

    Thank you. It’s working…….

  29. Kim

    Sorry to late ask. I want to know, are these techniques safe to use regarding SEO score ? Hope you answer !

  30. Kimmy

    Still works pretty well. Awesome, simple, and working. Thanks!

  31. 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?

  32. Lily

    Thank you. Worked like a charm!

  33. Prakash

    This Above Trick Is Not Working Man….

  34. 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.

  35. 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

  36. hrwhisper

    very helpful, thank you very much

  37. nitai

    Really great. today I just faced and thinking how can I disallow like joomla and I found the exact solution.

  38. Rob Myrick

    This was very helpful and quick – thank you

  39. 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

  40. 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. :)

  41. 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

  42. Ted

    The problem I have is that I can see the directory of this wordpress site, so if you are using this solution then it doesn’t work… (theme wpbv4)

  43. Rahul

    Thank you so much for the tutorial!

    I was very concerned when I discovered some of my theme directories could be browsed. All good now, thanks to your tutorial. I never knew .htaccess packed in so much punch.

  44. KeelAha

    Hello Syed Balkhi

    I just noticed that one of your site list25.com having directory browsing enabled on following folder.

    Not sure if that is important to you.

    http://list25.com/wp-includes/
    Have a great weekend and keep doing your good work.

    regards
    KeelAha

  45. Logan

    Why do I get a blank page, and not an error when I try to access the ../wordpress/wp-content/ or ../wordpress/wp-content/plugins/ ?

    • WPBeginner Support

      It may depend on your theme or your hosting environment. Try enabling directory browsing and then access these directories. If you still get a blank page then this means that those directories have a blank index.php file in them.

      Admin

  46. Charlie Sasser

    I tested this before I made any changes with a location that didn’t have an index.php or .htm file and yes you can see all of the files. I added the suggested line at the end of the .htaccess. The location now creates a 403 error from the host and not a 404 error from WordPress. I’m running WP 3.8. Is this the expected behavior?

    • Bern

      I have the same issue it shows 403 error not 404. Did you solve this problem?

    • Christian

      Same issue appear, what to do now? using latest version of wordpress.

  47. Abhisek

    Better WordPress Security plugin takes care of that.

    • Govinda

      How do I do it in Better Wp security.
      I have installed the plugin, but not able to find this feature

  48. Costin

    Hi,

    Could you please tell me if „Options All -Indexes“ is the same or better?

    Thank you!

  49. David Trees

    Thanks for this important information.

    Do you mean;

    Here

    Options -Indexes
    # END WordPress

    OR

    # END WordPress
    Options -Indexes

    Thanks for your reply.

    Cheers
    David

Schreibe einen Kommentar zu WPBeginner Support Antworten abbrechen

Danke, dass du einen Kommentar hinterlassen möchtest. Bitte beachte, dass alle Kommentare nach unseren kommentarpolitik moderiert werden und deine E-Mail-Adresse NICHT veröffentlicht wird. Bitte verwende KEINE Schlüsselwörter im Namensfeld. Lass uns ein persönliches und sinnvolles Gespräch führen.