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

Hinweis der Redaktion: Wir erhalten eine Provision für Partnerlinks auf WPBeginner. Die Provisionen haben keinen Einfluss auf die Meinung oder Bewertung unserer Redakteure. Erfahre mehr über Redaktioneller Prozess.

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

Das Durchsuchen von Verzeichnissen kann Ihre Website gefährden, da es Hackern wichtige Informationen liefert, die genutzt werden können, um Schwachstellen in den Plugins, Themes oder sogar dem Hosting-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 die Deaktivierung des Directory Browsing 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.

Das ist das Durchsuchen von Verzeichnissen, das oft standardmäßig aktiviert ist.

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 die Dateien, aus denen Ihre Website besteht, einschließlich aller Themes und Plugins, die Sie verwenden, mit Hilfe der Verzeichnisdurchsuchung einsehen können.

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.

So überprüfen Sie, ob das Verzeichnis-Browsing 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 Directory Browsing in WordPress

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

Um auf die Datei zuzugreifen, benötigen Sie einen FTP-Client oder Sie können die Dateimanager-App in Ihrem WordPress-Hosting-Kontrollpanel 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

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 für unsere Expertenauswahl des besten WordPress-Mitgliedschafts-Plugins zum Schutz Ihrer Dateien.

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 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. Jiří Vaněk says

    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?

      • Jiří Vaněk says

        Thanks for the advice, I finally used the Options -Indexes method now and AIO SEO already reports the problem as solved. Thanks again.

  3. Ka Khaliq says

    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?

  4. Pradip Singh says

    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.

  5. Jonthan says

    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.

  6. michael says

    Hello
    does this action affect pages indexing on search engines?
    and does it make some problems for indexed pages of my WordPress website?
    Thanks

  7. Shams says

    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

  8. Bill says

    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 says

      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

  9. Ionel G says

    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 says

      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

  10. Mayur says

    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]

  11. Deatram says

    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?

  12. Nathan says

    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

  13. Baggio says

    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!

  14. daniel says

    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!

      • Axel Jebens says

        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?

  15. Charles says

    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.

  16. Mike says

    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.

  17. Christian Nastari says

    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

  18. Anita in SD says

    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

  19. Heather Jacobsen says

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

  20. Wasil Burki says

    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

  21. Ted says

    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)

  22. Rahul says

    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.

Eine Antwort hinterlassen

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.