Welcome! Log In Create A New Profile

Advanced

Re: Rewrite a Shortened URL to a Pretty URL?

Edho Arief
August 22, 2012 02:32AM
On Wed, Aug 22, 2012 at 1:23 PM, slevytam <nginx-forum@nginx.us> wrote:
> Hi,
>
> 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 http://www.domain.com/1234 to
> http://www.domain.com/entry/index.php?id=1234. It works great.
>
> The problem is that I've realized that pretty urls are strongly preferred by
> google.
>
> So I would like following scenario:
> http://www.domain.com/1234 to rewrite to
> http://www.domain.com/entry/index.php?id=1234 while showing the user
> http://www.domain.com/1234/this-is-the-pretty-part in the address bar
>
> Can anyone tell me what is the best way to do this?
>

remove the permanent keyword. (note that there may be better way to do this)

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite a Shortened URL to a Pretty URL?

slevytam August 22, 2012 02:23AM

Re: Rewrite a Shortened URL to a Pretty URL?

Edho Arief August 22, 2012 02:32AM

Re: Rewrite a Shortened URL to a Pretty URL?

Javi Lavandeira August 22, 2012 05:08AM

Re: Rewrite a Shortened URL to a Pretty URL?

slevytam September 01, 2012 01:46PM

Re: Rewrite a Shortened URL to a Pretty URL?

Edho Arief September 01, 2012 01:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 293
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready