7

i have some issues with duplicate content on my website. in the past i had diverse stores setup and i disabled them but the urls seem to exist still. i would like to set up a forwarding rule example:

now i have 2 product pages:

website.com/product-abc-123

website.com/product-abc-123?___store=tienda

i would like to setup now that ?___store=tienda will always be redirected to original url. i have checked the ?___store=tienda product page holds the canonical link rel= canonical href= website.com/product-abc-123 but i would like to get rid of them as i have tons of them showing up in google webmaster tools.

same happens to my integrated blog in magento with the fishpig extension, i write blog articles and it seems that it creates duplicate content with the same url structure:

website.com/blog/category/article1.html

website.com/blog/category/article1.html?___store=tienda

Ideally i wish to create a rule in .htaccess file, what i could do already was to redirect all links from ?___store=tienda to home page adding following in .htaccess file

RewriteEngine On

RewriteCond %{THE_REQUEST} \?___store=tienda

RewriteRule ^(.*)$ /$1? [L,R=301]

source: https://stackoverflow.com/questions/16291281/rewriting-all-urls-with-a-question-mark

2

It seems you already answered your own question. I've placed the RewriteCond line and the RewriteRule line from your question in my .htaccess file (after the already existing 'RewriteEngine on') and did a curl request from my terminal to see what happens;

➜  hackathon  curl -vvv http://hackathon.dev/customer/account/index\?___store\=tienda
*   Trying 127.0.0.1...
* Connected to hackathon.dev (127.0.0.1) port 80 (#0)
> GET /customer/account/index?___store=tienda HTTP/1.1
> Host: hackathon.dev
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 15 Jan 2016 08:20:26 GMT
< Server: Apache/2.4.16 (Unix) PHP/5.6.16
< Location: http://hackathon.dev/customer/account/index
< Content-Length: 251
< Content-Type: text/html; charset=iso-8859-1

As you can see, it does a 301 redirect from http://hackathon.dev/customer/account/index?___store=tienda to http://hackathon.dev/customer/account/index, exactly as you described.

When I try another store, it correctly responds with a 302;

➜  hackathon  curl -vvv http://hackathon.dev/customer/account/index\?___store\=otherstore
*   Trying 127.0.0.1...
* Connected to hackathon.dev (127.0.0.1) port 80 (#0)
> GET /customer/account/index?___store=otherstore HTTP/1.1
> Host: hackathon.dev
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 302 Found

So what exactly is it that you haven't got working right now? Does the redirect even work? If not, maybe your host is running nginx?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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