Server Fault is a question and answer site for system and network 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 want to setup simpler urls in nginx to login into wordpress i.e. /admin /login in nginx

I have tried multiple ways of tackling this with no luck. any ideas?

currently working with this, but I know it's not working

if ($uri ~* "/login") { rewrite ^(.*)$ http://$host/wp-admin/; }

Final Working Version: if ($uri ~* "/login") { rewrite ^/login(/.*)? /wp-admin$1; }

share|improve this question
Please show us all the ways which you had tried? – quanta Sep 22 '11 at 13:16
good point, I just posted what I am working with – chrishough Sep 22 '11 at 13:19
What did you get when you access http://$host/login in browser? Did you take a look at error log? – quanta Sep 22 '11 at 13:30
up vote 0 down vote accepted

Rewriting works largely the same as in Apache, but with different syntax:

Something like this should do the trick:

rewrite ^/admin(/.*)? /wp-admin$1
share|improve this answer
thank you so much for your help, I was able to use your segment to add the "login" I wanted. # short cuts if ($uri ~* "/login") { rewrite ^/login(/.*)? /wp-admin$1; } – chrishough Sep 28 '11 at 1:02

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.