Wordpress - httacces ip adresse

Dseller

Medlem
| Jeg har gjort følgende og det funker helt fint, men etter det har gått noen dager så blir dette bare helt borte

<Files ~ "^wp-login.php">
Order deny,allow
Deny from all

Allow from x.x.x.x
</Files>

Noen som vet hvorfor dette bare forsvinner?



You can use your site's .htaccess file to only allow requests from your computer's local IP address.

*!* If you have either a dynamic IP address, or you access WordPress from multiple devices, each IP address that you access WordPress with would also need to be allowed in your .htaccess file. *!*

In order to find out your local computer's IP address, you can simply visit the following URL: http://icanhazip.com

After you have your local IP address, you can follow these steps in order to lock down your WordPress site to only permit logins from your IP address:

1. Login to cPanel.
2. Under the Files section, click on the File Manager icon.
3. From the Document Root for: drop-down, select your WordPress site.
4. Make sure that Show Hidden Files is checked.
5. Click Go.
6. Right-click on your .htaccess file, then click on Edit.
7. You may have a dialog pop-up from the text editor, go ahead and click Edit.
8. Now you can just paste in the following code, being sure to replace the x.x.x.x IP address with your own:

<Files ~ "^wp-login.php">
Order deny,allow
Deny from all

Allow from x.x.x.x
</Files>
 

Bjørnar

Gründer
Sjekk datoen på når fila sist ble endret. WordPress har en ufattelig evne til å åpne og lagre fila på nytt, så jeg vil tippe at datoen for fila di er nyere enn når du manuelt redigerte den?
 

Bjørnar

Gründer
Uten at jeg vet, så tror jeg trikset er å putte dine custom saker i toppen, over # BEGIN WordPress

Test ut det, så tror jeg du har en løsning som virker.
 

adeneo

Medlem
Sjekk om noe sånt virker (hvor IP er 111.111.111.111) :

PHP:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/wp-admin$
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111$
RewriteRule ^(.*)$ – [R=403,L]
 

Dseller

Medlem
Sjekk om noe sånt virker (hvor IP er 111.111.111.111) :

PHP:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/wp-admin$
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111$
RewriteRule ^(.*)$ – [R=403,L]

Funker den men hvordan legger jeg til fler ip adresser?
 

adeneo

Medlem
Du kan legge til flere nedover slik :

PHP:
RewriteEngine on 
RewriteCond %{REQUEST_URI} ^/wp-login\.php(.*)$ [OR] 
RewriteCond %{REQUEST_URI} ^/wp-admin$ 
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111$ [OR]
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$ [OR]
RewriteCond %{REMOTE_ADDR} !^321\.321\.321\.321$
RewriteRule ^(.*)$ – [R=403,L]

eller bruke en bitwise OR (|)

PHP:
RewriteCond %{REMOTE_ADDR} !^(111\.111\.111\.111|123\.123\.123\.123)$
 
Topp