I need some urgent rewrites

I need some urgent rewrites

From:
http://www.my-domain.de/kalorientabelle.php/unterkategorie/204-suppen
To:
http://www.my-domain.de/kalorientabelle/suppen.204/unterkategorie

From:
http://www.my-domain.de/kalorientabelle.php/unterkategorie/3-vollkornbrot
To:
http://www.my-domain.de/kalorientabelle/vollkornbrot.3/unterkategorie

AND

From:
http://www.my-domain.de/kalorientabelle.php/produkt/6293-alkopops
To:
http://www.my-domain.de/kalorientabelle/alkopops.6293/produkt

From:
http://www.my-domain.de/kalorientabelle.php/produkt/16648-schoko-reiswaffel

To:
http://www.my-domain.de/kalorientabelle/schoko-reiswaffel.16648/produkt

I would be very happy if someone can help me.

Posted at Nginx Forum:

WOW, thanks Aleksandar. that works for my.

I hope you can help me with another rewrite.

from:
http://www.my-domain.de/attachments/hundebilder-hundefotos-fotowettbewerbe/67591d1394397097-hund-monats-april-2014-dsc06022.jpg

to:
http://www.my-domain.de/attachments/dsc06022-jpg.67591/

OR

from
http://www.my-domain.de/attachments/alte-fotowettbewerbe-hunde/61955d1389003298-hund-jahre-2013-hund-mai.jpg

to
http://www.my-domain.de/attachments/hund-mai-jpg.61955/

My attempts have all failed.

Posted at Nginx Forum:

Hi.

Only syntax checked.

Please read for further investigation.

http://nginx.org/en/docs/varindex.html
http://nginx.org/r/location
http://nginx.org/r/return

Am 21-03-2015 16:57, schrieb Milos:

I need some urgent rewrites

From:
http://www.my-domain.de/kalorientabelle.php/unterkategorie/204-suppen
To:
http://www.my-domain.de/kalorientabelle/suppen.204/unterkategorie

[snip]

This should work for all your examples.

location ~ (\w+).php/(\w+)/(\d+)-([\w-]+) {
return 302 $scheme://$hostname/$1/$4.$3/$2;
}

I would be very happy if someone can help me.

BR Aleks

Dear Milos.

Am 22-03-2015 15:26, schrieb Milos:

WOW, thanks Aleksandar. that works for my.

[snipp]

My attempts have all failed.

What was your attempts and how does they failed?

Have you also take a look into this link and the other links in my first
answer?

http://nginx.org/en/docs/http/converting_rewrite_rules.html