Welcome! Log In Create A New Profile

Advanced

Big rewrite problem - permanent redirect

Posted by benek 
Big rewrite problem - permanent redirect
September 28, 2011 04:15PM
Hello i would like to permanently

rewrite ^/asd/(.*)-(.*)/$http://something.yourwebsite.com/asd/$1-$2 permanent;

And it doesnt work !

If i try to replace "-" with "/"

rewrite ^/asd/(.*)/(.*)/$http://something.yourwebsite.com/asd/$1/$2 permanent;

it works ok.

Theres a problem with "-" sign.

I tried using "\-", "\-/" but doesnt work ;/



Edited 2 time(s). Last edit at 09/28/2011 04:16PM by benek.
Re: Big rewrite problem - permanent redirect
September 30, 2011 08:18AM
benek Wrote:
-------------------------------------------------------
> Hello i would like to permanently
>
> rewrite
> ^/asd/(.*)-(.*)/$http://something.yourwebsite.com/
> asd/$1-$2 permanent;
>
> And it doesnt work !
>
> If i try to replace "-" with "/"
>
> rewrite
> ^/asd/(.*)/(.*)/$http://something.yourwebsite.com/
> asd/$1/$2 permanent;
>
> it works ok.
>

Shouldn't there be a space between the first and second rewrite arguments? Eg:

rewrite ^/asd/(.*)-(.*)$ http://something.yourwebsite.com/asd/$1-$2 permanent;

better variant:

rewrite ^/asd/([^-]+-.*)$ http://something.yourwebsite.com/asd/$1 permanent;

Andrejs
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
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