Rewrite with apostrophe causes 404

Hello,

videos/1432/so-it/'s-ok-karyn-garcia

above causes 404

if i manually edit the url to videos/1432/so-it’s-ok-karyn-garcia it
works

Here is the rewrite rule

rewrite ^/videos/([^/])/([^/])$ /play.php?vid=$1 last;

Can you tell me how can i fix this ?

Thanks.

Posted at Nginx Forum:

on opera and firefox the urls are automatically corrected and workin
with the rewrite rules like follows

videos/1432/so-it%5C%27s-ok-karyn-garcia

but on internet explorer its not being corrected.

Posted at Nginx Forum:

I solved this myself, forgot to put the solution here, the following
removes /’ and replaces it with nothing so urls work in all browsers.

if ($uri ~ “^(.)/'(.)$”){
set $rule_0 1$rule_0;
set $bref_1 $1;
set $bref_2 $2;
}
if ($rule_0 = “1”){
rewrite /. /$bref_1$bref_2 permanent;
break;
}

Maybe this will help someone too.

Posted at Nginx Forum:

On Sun, May 23, 2010 at 04:47:49PM -0400, st1905 wrote:

rewrite ^/videos/([^/])/([^/])$ /play.php?vid=$1 last;

Can you tell me how can i fix this ?

location = /videos/1432/so-it/'s-ok-karyn-garcia {
fastcgi_pass …
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/play.php;
fastcgi_param QUERY_STRING vid=1432/so-it/'s-ok-karyn-garcia;
}


Igor S.
http://sysoev.ru/en/

Thanks a lot Igor. It works just like the way it should be but there are
thousands of videos and i dont know how many of them have this issue.

Posted at Nginx Forum: