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

Wie man den WordPress-Admin-Zugang nach IP-Adresse einschränkt

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 den Zugang zu Ihrem WordPress-Adminbereich aus Sicherheitsgründen einschränken?

Wenn Sie ein kleines Team haben, besteht eine gute Lösung darin, den Zugriff nur auf die IP-Adressen zu beschränken, die von den Teammitgliedern verwendet werden.

In diesem Artikel zeigen wir Ihnen, wie Sie den WordPress-Admin-Zugang nach IP-Adresse einschränken können, Schritt für Schritt.

How to Restrict WordPress Admin Access by IP Address

Warum den WordPress-Admin-Zugang nach IP-Adresse einschränken?

Wenn Sie eine WordPress-Website betreiben, dann müssen Sie die Sicherheit Ihrer Website ernst nehmen. Obwohl die WordPress-Kernsoftware sehr sicher ist, können Sie noch mehr tun, um sich vor Hackern und Brute-Force-Angriffen zu schützen.

Hacker können Ihre Website lahmlegen sowie Ihre Einnahmen und Ihren Ruf schädigen. Sie können Daten stehlen oder sogar Malware an Ihre Website-Besucher verteilen und dafür sorgen, dass Ihre Domain bei Google und anderen auf die schwarze Liste gesetzt wird.

Eine intelligente Methode, um Hacker abzuwehren und die Sicherheit von WordPress zu verbessern, ist der Schutz des WordPress-Administrationsbereichs vor unbefugtem Zugriff.

Wenn nur Sie oder einige wenige vertrauenswürdige Benutzer Zugriff auf den Admin-Bereich benötigen, ist es eine gute Möglichkeit, den Zugriff auf wp-admin und die WordPress-Login-Seite auf die IP-Adressen Ihres Teams zu beschränken.

Jedes Teammitglied verbindet sich mit Ihrer WordPress-Website über eine bestimmte IP-Adresse für jeden Standort. Wenn Sie den Zugang zu allen anderen IP-Adressen blockieren, kann ein Hacker nicht auf Ihre Website zugreifen, selbst wenn er Ihren Benutzernamen und Ihr Passwort herausgefunden hat.

Stattdessen wird die Fehlermeldung angezeigt: ‚Verboten. Sie haben keine Berechtigung, auf diese Ressource zuzugreifen“.

Schauen wir uns an, wie man den WordPress-Admin-Zugang nach IP-Adresse einschränken kann.

Wie man den WordPress-Administrator-Zugang nach IP-Adresse einschränkt

Als Erstes müssen Sie eine Liste der IP-Adressen erstellen, die von allen Personen verwendet werden, die sich bei Ihrer WordPress-Website anmelden müssen. Wenn jemand von mehreren Standorten aus arbeitet, müssen Sie die IP-Adressen für jeden einzelnen Standort erfassen.

Sie können ihre IP-Adresse erfahren, indem sie eine Website wie SupportAlly besuchen.

Sobald Sie Ihre Liste erstellt haben, müssen Sie eine Datei auf Ihrer Website bearbeiten. Dazu müssen Sie einen FTP-Client oder die Dateimanager-App Ihres Hosting-Anbieters verwenden. Wenn Sie noch nie mit FTP gearbeitet haben, sollten Sie sich unsere Anleitung zum Hochladen von Dateien mit FTP in WordPress ansehen.

Sie müssen die Software verwenden, um zum Ordner /wp-admin/ Ihrer Website zu navigieren. Dort sollten Sie nach der Datei .htaccess suchen. Dies ist eine versteckte Datei. Wenn Sie sie also nicht sehen können, müssen Sie möglicherweise die Option „Versteckte Dateien anzeigen “ in Ihrer Software aktivieren.

Navigate to wp-admin and Locate .htaccess

Wenn diese Datei in dem Ordner nicht vorhanden ist, sollten Sie eine neue Datei erstellen und sie unter dem Namen .htaccess in Ihrem /wp-admin/ Ordner speichern.

Warnung! Bearbeiten Sie nicht Ihre Stammdatei .htaccess, sonst sperren Sie Besucher vom Frontend Ihrer Website aus! Stellen Sie sicher, dass Sie /wp-admin/.htaccess bearbeiten.

Sie sollten zunächst eine Kopie der Datei auf Ihren Computer herunterladen, um sie zu sichern. Danach müssen Sie .htaccess bearbeiten und den folgenden Code einfügen:

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "WordPress Admin Access Control"
AuthType Basic
<LIMIT GET>
order deny,allow
deny from all
# whitelist Syed's IP address
allow from xx.xx.xx.xxx
# whitelist David's IP address
allow from xx.xx.xx.xxx
# whitelist Amanda's IP address
allow from xx.xx.xx.xxx
# whitelist Muhammad's IP address
allow from xx.xx.xx.xxx
# whitelist Work IP address
allow from xx.xx.xx.xxx
</LIMIT>

Bearbeiten Sie die Datei so, dass sie mit den Namen Ihrer eigenen Teammitglieder übereinstimmt, und fügen Sie dann die IP-Adressen ein, die Sie zuvor gesammelt haben, um die Stelle zu ersetzen, an der xx.xx.xx.xxx steht.

Sobald Sie die Datei gespeichert haben, können nur noch diese IP-Adressen auf den WordPress-Admin zugreifen.

Denken Sie daran, dass Sie von Ihrem WordPress-Administrationsbereich ausgesperrt werden, wenn sich Ihre IP-Adresse ändert oder Sie versuchen, von einem neuen Standort aus auf Ihre Website zuzugreifen. Sie müssen Ihre neue IP-Adresse in die Datei /wp-admin/.htaccess aufnehmen.

Wir hoffen, dass dieses Tutorial Ihnen geholfen hat, zu lernen, wie man den WordPress-Administrator-Zugang nach IP-Adresse einschränkt. Vielleicht interessiert Sie auch unser WordPress-Tutorial darüber, wie Sie ein kostenloses SSL-Zertifikat für Ihre Website erhalten, oder unsere Liste der unverzichtbaren Plugins für das Wachstum Ihrer Website.

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 .

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

43 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!

    • WPBeginner Support says

      There are multiple methods to find your IP, one of the simple ones would be to use a site like supportally.com

      Admin

  2. Solace says

    I tried the .htaccess password protection method.

    It works, but I tried it on a site with Woocommerce, but then my customers weren’t able to log in.

    Just saying that because it seems no one has mentioned that it doesn’t work with sites that need customers to log in !

  3. Miguel says

    Hello, thank you for the tutorial. Unfortunately, I have not been able to make this .htaccess file to work correctly because it is denying access to the only IP address I included, my own… I am certain I copied your code exactly and I typed my IP correctly. The .htaccess file was saved under: /wp-admin/.htaccess

    Am I missing something? Thanks

  4. Emaan Ali says

    Hi Guys,

    I have blocked the wp-admin with .htaccess as mentioned in this article. But i am having one problem that my admin-ajax file is also being restricted on public site.

    My wordpress theme uses much of admin ajax functionality and that I have put the IP limitation access on wp-admin folder so its not accessible for all IP’s.

    Does anyone find the solution for this ? If so please share .

    Thanks in advance
    Emaan

  5. Len says

    Hi, This seems really a helpful one. Maybe you could help me. Instead of whitelisting an IP can we allow access for specific countries in .htaccess file? Hoping you can help me. Thank you very much.

  6. Scotty says

    Hi, This does work. I checked and am „forbidden“ to login on any other computer. I can’t even see the login panel. However, I am still getting about 24 failed log in attempts per day from all different IP addresses. Any ideas how there getting around this? It’s some kind of brute force attack? Thanks, Scott.

  7. Sehrish says

    And how to allow access to only wordpress adminitrator ?What code i will write without any ip ? I just need to know a generic function that get admin related info.Becuse i have to restrict my plugin uploads from other user.And Whoever using this plugin i have to get its admin info to restrict contents from other and allow only to admin of website.

  8. Kim says

    I tried this (after previously successfully password protecting my wp-admin directory and fixing the redirect error per your other article), but then I get a pop-up asking for a user name and password for the „WordPress Admin Access Control“. What user name and password am I supposed to be using for this new pop-up? Neither the wordpress admin logon nor the wp-admin directory logon work for it.
    Thanks!

    • Kim says

      Oh, I believe I figured out the problem; seems to work as long as I make sure to have the added code at the very beginning.

  9. Jordyn says

    I have a big problem :(

    I did what you said about creating the .htaccess and putting in the code snippet. It didn’t work so I deleted the .htaccess file and now I can’t login to my dashboard! It’s just a white screen :( Please help!!!

    Thanks

      • Jordyn says

        All I did was create the file in my wp-admin folder and when it didn’t work I deleted it from the wp-admin folder. I’m not sure what happened but, after a crazy rabbit trail and many shots in the dark, I was able to correct the problem by adding to the top of my login.php file. I still don’t know what went wrong or why what I did fixed it…. but at least its fixed. I may try this again when I’m feeling brave.

  10. Raheem Khan says

    Hi WPB, I don’t think it will be working in Pakistan because every time we reset or turn of our DSL modem so the IP address automatically changes. if any other tip please reply me.
    Thanks

  11. andrew says

    hi, how to make .htaccess with dynamic ip (non static ip)
    my ip is always change xxx.xxx.xxx.12 xxx.xxx.xxx.453 xxx.xxx.xxx.076

    please help…

      • Joe says

        You can harden your wordpress install via .htaccess whitelisting even if you have a dynamic IP address. You can whitelist a range of IP addresses using a /24 or /16 range. While this allows more access than if you always knew the IP you wanted to allow, it still prohibits access from almost the entire internet.

        Just add /24 to the end of the allow from line to allow the whole class C subnet (256 IPs), or add /16 to allow the whole 65,536 range. i.e.

        allow from xxx.xxx.xxx.0/24

        will allow access to IP addresses from xxx.xxx.xxx.0 – xxx.xxx.xxx.255. and

        allow from xxx.xxx.0.0/16

        will allow access from IP addresses from xxx.xxx.0.0 – xxx.xxx.255.255

  12. Kyle says

    You say not to do the root site’s .htaccess file…why is that? Because you just want to limit access to the /wp-admin folder?

    So…if I wanted to have a WordPress site hosted externally but used as an internal company resource so that only people using IPs of our company could access it…if I edited the root folder’s .htaccess folder to only allow IPs from our domain…that would work the same way your /wp-admin fix is, but for the entire site, correct?

    • Editorial Staff says

      Yes Kyle, the reason why we said do not put this code in the root file because then it will limit your site access to only these IP as well. But if you are trying to make a site just for your company’s staff can access it only from work, then you would want to put the .htaccess file in the root folder.

      Admin

    • Alim Bolar says

      Can I limit access based on other criterias? Like I need only my laptop to access a particular folder.. I could access it from anywhere so it would be difficult to specify an IP as my internet access would be based on DHCP. Is there a unique identifier for every machine or something like that that can be used as a criteria?

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.