Remove query string from url
9,822
If you need to delete the querystring __store= from the URL you have to clear the variable $args and then rewrite the main location.
Try to use this rule to delete the querystring from the url:
location / {
set $args '';
rewrite ^/(.*)$ /$1 permanent;
}
or if you have a website url like: http://www.mystore.com/shop/index.php?__store=en you can rewrite the new location with:
location /shop {
set $args '';
rewrite ^/shop/(.*)$ /shop/$1 permanent;
}
Related videos on Youtube
Author by
Holly
I am a user who prefers to keep an air of mystery about myself, apparently.
Updated on September 18, 2022Comments
-
Holly over 1 year
We have a magento store which appends a query to our URL when you change Magento store views on the frontend.
i.e. http://www.domain.com/?___store=uken
Is there a way to remove the ?___store=uken with NGINX configuration? Say remove any query beginning with ?___store=. I'm very new to server config & nginx in particular.
-
ngn almost 9 years
-
ngn almost 9 yearsIf this is the default behaviour of Magento, then Http rewrite may end up affecting functionality. Magento needs to be configured to use POST requests instead of GET so that query parameters are not explicitly visible.
-
Holly almost 9 years@ngn, I think you're right. I'm over thinking it and should probably leave the magento default behavior alone. I've also realized that the query string is only appended when the user switches stores.
-
-
Andrew Schulman about 6 yearsPlease add some explanation.
-
Cavid Muradov about 6 years@AndrewSchulman done!