Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to do a simple rewrite, and can't find out how.

Rewrite "http://example.com/"index.php/administrator/catalog_product/new/"dumpidum" to "http://example.com/"index.php/administrator/catalog_product/new/set/4/type/simple/"dumpidum"

What I found out is:

rewrite /index\.php/administrator/catalog_product/new/(.*)$ /index.php/administrator/catalog_product/new/set/4/type/simple/$1;

But this isn't working as expected.

note: apache2 code would be:

Redirect 302 /index.php/administrator/catalog_product/new/key/ http://example.com/index.php/administrator/catalog_product/new/set/4/type/simple/key/

Does someone see what I'm doing wrong? I'm desperate to know.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You asked for a rewrite, but your Apache example is a redirect. Unless you specify otherwise, nginx will do a rewrite on relative paths. You need to specify the redirect flag to the rewrite directive in order to send a redirect.

rewrite ^/index\.php/administrator/catalog_product/new/(.*)$ /index.php/administrator/catalog_product/new/set/4/type/simple/$1 redirect;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.