Welcome! Log In Create A New Profile

Advanced

Rewrite regex with percent signs

May 22, 2016 07:16AM
Hello, I am helping an admin sort out some 404 issues by using some rewrite which have generally been successful. However we have a couple of cases that are a bit mysterious and hope you can help explain. This is from a vbulletin forum that used to use the vbseo extension to make the url's prettier but that extension has been dropped now so posts with those pretty url's don't point the correct places.

For example, we have a url of the following:
/members/redrobes-albums-2d%20vs%203d%20?-picture12345-mt-pub01.jpg

it needs to go to

/attachment.php?attachmentid=12345

we have:

location /members/ {
rewrite ^/members/.+-albums-.+-picture(\d+)-.* /attachment.php?attachmentid=$1? redirect;
}

and this particular one is not working. It works with many others where the original url did not have the %20's in them. So there is something about those %20's that are causing these to fail.

I can write a perl script and run that url through its regex and it does change them.

So what does the nginx regex do different from perl regex with regard to % signs.

Thanks.
Subject Author Posted

Rewrite regex with percent signs

redrobes May 22, 2016 07:16AM

Re: Rewrite regex with percent signs

Francis Daly May 22, 2016 09:44AM

Re: Rewrite regex with percent signs

redrobes May 22, 2016 01:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 56
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready