WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to be sneaky with iis to secure a wordpress login page (not my choice to run a windows server, but that's the reality of things). It's worked so far, only the login page itself loads itself before forwarding you to the admin panel so after a successful (or unsuccessful) login the first rule kicks in and sends you to the dummy page. My rules so far:

<rule name="redirect" patternSyntax="ECMAScript">
    <match url="^installbase/wp-login\.php" />
    <action type="Rewrite" url="installbase/index.php?page=403-forbidden" />

<rule name="login" patternSyntax="ECMAScript">
    <match url="^sneakyURLforLoggingIn" />
    <action type="Rewrite" url="installbase/wp-login.php" />

1: I'm sure there's a more efficient way to do this

2: once wordpress accepts the login it sends you to the 403 page, requiring the user to then manually navigate to /wp-admin/. That's less than ideal.

Any thougths on how to solve this catch-22? Or is there a better way to accomplish the same thing?

share|improve this question

You can instruct IIS to provide to wp-login a redirect_to parameter towards wp-admin/; this will do the trick:

<rule name="login" patternSyntax="ECMAScript">
     <match url="^loginUrl/?" />
     <action type="Rewrite" url="wp-login.php?redirect_to={UrlEncode:http://{HTTP_HOST}/wp-admin/}" />

By the way, thanks for posting this question, it's helping me to understand better the working of redirects and rewrites in IIS. I found this reference useful: String functions in IIS Rewrite Module

share|improve this answer
Thanks for the fix in grammar @pat-j :) – jefrancomix Jan 21 '14 at 22:54

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.