Rewrite a Shortened URL to a Pretty URL?

slevytam nginx-forum at nginx.us
Sat Sep 1 17:46:46 UTC 2012


Hi,

Thank you for your reply.  Sorry for the late response but the forum didn't
notify me of your post.

I tried your suggestion.  

rewrite ^/(.*?)/.*$ /entry/index.php?id=$1 permanent;

It works for http://www.domain.com/1234/pretty-url-goes-here but it does not
work for http://www.domain.com/1234.

Also, it does not leave the url as entered.  So, for example, if you input
http://www.domain.com/1234/pretty-url-goes-here it changes the address bar
to http://www.domain.com/entry/id=1234 instead of staying at the pretty
url.

Any thoughts?

Thanks,

slevytam

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,229974,230447#msg-230447



More information about the nginx mailing list