Rewrite a Shortened URL to a Pretty URL?

slevytam nginx-forum at
Wed Aug 22 06:23:16 UTC 2012


I was hoping someone could help me with a rewrite question.  

Currently, I use a basic rewrite for my url shortener.

if (!-e $request_filename) {
     rewrite ^/(.*)$ /entry/index.php?id=$1 permanent;

This forwards a url like to  It works great. 

The problem is that I've realized that pretty urls are strongly preferred by

So I would like following scenario: to rewrite to while showing the user in the address bar

Can anyone tell me what is the best way to do this?



Posted at Nginx Forum:,229974,229974#msg-229974

More information about the nginx mailing list