Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to rewrite /wp-login.php?action=register to /register, but only if it's a GET request.

Here's what I have so far, while it doesn't error it just doesn't do anything..

location /wp-login.php {
    if ( $request_method = GET ) {
        set $login_post_req "herp";
    }

    if ( $args ~ ^action=(register) ) {
        set $login_post_req "${login_post_req}derp";
    }

    if ( $login_post_req = "herpderp" ) {
        rewrite / /register permanent;
        break;
    }
}

Thanks :)

share|improve this question
add comment

1 Answer

try this:

    if ( $login_post_req = "herpderp" ) {
    rewrite /wp-login.php /register permanent;
    break;

maybe this:

rewrite /wp-login.php /register? permanent;

to avoid /register/?action=register

share|improve this answer
    
I'd tried that previously and it doesn't seem to make a difference.Thanks though. –  James White Mar 21 '12 at 20:12
    
Sorry ... dont have access to my ngninx box right now, will work on it tonight. On the surface it doesnt seem that hard to make it work! –  Rostol Mar 21 '12 at 22:34
    
Thanks man. I tried moving it inside my main location / block as well like so d.pr/pcGy but the fundamental problem seems to be I can't even get a basic rewrite from wp-login.php to /register working. I've tried just rewrite ^(/wp-login.php) /register permanent; on it's own and still no joy :/ –  James White Mar 21 '12 at 22:38
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.