Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Lately we had a lot of requests to our wp-login.php on one of our wordpress installations. So after reading up a little, I decided to allow access only to the two static IPs we use in the office, using the following lines of code right at the top of the .htaccess :

<Files wp-login.php>
 order deny,allow
 deny from all
 allow from
 allow from

However after doing this, the /wp-admin/ link now redirects to our homepage, and the wp-login.php file gives me the "The page isn't redirecting properly" error in firefox (or too many redirects in chrome)

Untill today the .htaccess looked like this :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

If I delete the mod_rewrite part the deny rules work ok, if I delete the deny rules I can access the /wp-admin/ and wp-login.php just like before. I tried the deny rules in the .htaccess of another site without rewrites and it works OK.

What am I missing here ? I know it's something simple. Thank you !

share|improve this question
Where are the browsers getting redirected to? – Shane Madden Jul 18 '13 at 6:14 gets redirected to, and I'm guessing (by the error) that wp-login.php gets redirected to itself over and over again. – noru Jul 18 '13 at 6:21
Interesting. Are you able to turn on a RewriteLog and set RewriteLogLevel 9 to capture logs of it happening? – Shane Madden Jul 18 '13 at 6:23
It's a shared hosting unfortunately, I don't have root access, only CPanel. – noru Jul 18 '13 at 8:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.