Tag Info

Hot answers tagged

2

nginx always requires the leading slash in the URI part of the rewrite, while Apache doesn't want it. Without seeing the complete configuration, this is just a guess what the problem might be. Try this: rewrite ^/([^/]*)/([^/]*)\.html$ /?cmm=$1&page=$2 last;


2

server { ... rewrite ^/widget$ /widget/index.php last; rewrite ^/widget/$ /widget/index.php last; rewrite ^/widget\?act=list$ /widget/index.php?act=list last; rewrite ^/widget/\?act=list$ /widget/index.php?act=list last; rewrite ^/widget/list$ ...


2

Try this block for the public location: location /public { if ($args ~ "^pid=(?<placepid>[0-9]+)$") { rewrite ^/places /index.php?url=places/view/$placepid last; } if ($args ~ "^q=(?<getq>.+)&l=(?<getl>.+)$") { rewrite ^ /index.php?url=search/index/$getq/$getl last; } if ($args ~ ...


1

The RewriteRule has some not needed stuff, which could cause this behavior. Try this instead: RewriteRule ^/assets/img/newsletter/(.+)$ https://s3.amazonaws.com/mybucket/newsletters/legacy/$1 [R=301,L] Here I use the "one-or-more" quantifier to regex, so that $1 cannot be empty at any point.


1

Since you capture the part of the URI you are interested in already in the first RewriteCond block, you don't have to capture it again to do the RewriteRule, and since both of your RewriteConds are met, there's no need to parse the URI a third time, so a simple caret would do it. # Is it in the newsletters directory RewriteCond %{REQUEST_URI} ...



Only top voted, non community-wiki answers of a minimum length are eligible