Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>

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

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
add comment

1 Answer

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/}" />
</rule>

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 at 22:54
add comment

Your Answer

 
discard

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.