Permanent Redirect

Hi there,

I’m trying to permanently redirect various outdated URLs to the domain’s
home page like so:

location /phpshop {
rewrite ^ http://www.my-domain.com permanent;
}

which results e.g. in

http://www.my-domain.com/phpshop/?page=shop/flypage&product_id=65

to be rewritten to

http://www.my-domain.com?page=shop/flypage&product_id=65

which kind of makes sense, but I need to strip those parameters (page
and product_id), too.

Any ideas on how to accomplish this?

Here’s my complete virtual host configuration:

http://openstream.pastebin.com/N09mUUef

Any pointers would be very much appreciated.

Cheers, Nick
Openstream Internet Solutions

Posted at Nginx Forum:

Any ideas on how to accomplish this?

again?

On Tue, Apr 20, 2010 at 16:43, Nick W. [email protected] wrote:

http://www.my-domain.com/phpshop/?page=shop/flypage&product_id=65

to be rewritten to

http://www.my-domain.com?page=shop/flypage&product_id=65

which kind of makes sense, but I need to strip those parameters (page and
product_id), too.

from an SEO point of view, you should make sure people get into the
new page of that given product when using it’s old URL… or say good
bye to your pagerank :stuck_out_tongue:

On Tue, Apr 20, 2010 at 04:43:19PM +0200, Nick W. wrote:

Here’s my complete virtual host configuration:

http://openstream.pastebin.com/N09mUUef

Any pointers would be very much appreciated.

  • location /phpshop {
  • location = /phpshop/ {


Igor S.
http://sysoev.ru/en/

Hello!

On Tue, Apr 20, 2010 at 04:43:19PM +0200, Nick W. wrote:

http://www.my-domain.com/phpshop/?page=shop/flypage&product_id=65

to be rewritten to

http://www.my-domain.com?page=shop/flypage&product_id=65

which kind of makes sense, but I need to strip those parameters
(page and product_id), too.

Any ideas on how to accomplish this?

rewrite ^ http://www.my-domain.com/? permanent;

(note “?”)

It should be here:

http://wiki.nginx.org/NginxHttpRewriteModule#rewrite

But it looks like rewrite directive description was polluted by
lots of semi-related user notes and currently unreadable. Sombody
has to throw/move them all away and re-translate original docs.

To all: please keep module docs / directive descriptions close to
original docs if possible. If you think that something should be
noted - add trailing note clearly separate from documentation, or
even add it on separate wiki page.

Maxim D.

How about this?

location /phpshop {
rewrite ^.*$ http://www.my-domain.com permanent;
}

Ray.