Tag Info

New answers tagged

0

There is a much cleaner way to do this with a header: Cookie: oraclelicense=accept-securebackup-cookie;


0

Because the number and the permalink is dynamic, here the proposed solution location ~* ^/(((?!/).)+)-(\d+)\.html$ { return 301 $scheme://$host/$3/$1-$3.html; } For redirect, you can use return instead rewrite. For explanation the regex scheme, please refer this site.


0

Test this one out: rewrite ^/?permalink-(\d+).html http://domain.com/$1/permalink-$1.html permanent;


3

With three rules you can match the example cases and following versions of the widgets: rewrite ^\/widget\/(v\d+)\/?(\?act=)?(.*)$ /widget/$1.php?act=$2 last; rewrite ^\/widget\/?$ /widget/index.php last; rewrite ^\/widget\/?(\?act=)?(.*) /widget/index.php?act=$2 last; I have written these using a online regexp tester but did not setup a test environment ...


0

You can use regex in server_name in order to get the TLD in a variable: server_name ~(www\.)?domain\.(?<tld>\w+)$; Now you can use it: rewrite ^(.*)$ /$tld/$1;


0

While useful, the redirect approach you propose does not offer the same security benefits as putting https urls in the right places on your pages in the first place. If a user submits a request over HTTP, and receives a redirect response, then any data they have submitted will have travelled to your site in cleartext. You are only getting protection for ...


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

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} ...


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.


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

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;



Top 50 recent answers are included