Permanent Redirect

Igor Sysoev igor at sysoev.ru
Tue Apr 20 18:57:01 MSD 2010


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

> Hi there,
> 
> I'm trying to permanently redirect from 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.

- location /phpshop {
+ location = /phpshop/ {

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


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list