Is there any way to replace “&” with “&” in Ma

2019-08-25 04:45发布

问题:

Is there any way to to replace & with & in magento url. Every time when magento URL is redirecting from one store to another it is adding & between the url. And the url is breaking. for eg:

https://www.indelust.com/designer?d=370

Above URL is the default url which is linked to US storeview based on US geoIP. When I am clicking on the url from Google search results it should redirect me to the same page with respective storeview. Now below url is the one when I clicked on google search result.

https://indelust.com/in/designer?___store=in_storeview&d=370

And the above link is breaking.

When I am making a small correction in the above url, by changing & to &. Then it is working fine for me.

I gone through some tutorials and below I found the relevant one, but I did not get the answer to resolve based on magento url pattern. https://magento.stackexchange.com/questions/38513/amp-instead-of-in-language-switch-url

Can anybody help me?

回答1:

You should find out why the issue appears, but if you just want to replace the url you should add this to your .htaccess file:

RewriteEngine On
RewriteRule ^(.*)&(.*)$ /$1&$2 [L,R=301]


回答2:

An htaccess file is a set of rules a server runs through for each page request. Adding all of your old URLs to this file means that for every page visit your server has to do a lot more work - it has to compare the URL the user is visiting to all of the old URLs you have added to the file. Magento isn't renowned for its blistering speed, so slowing down every request seems like something worth avoiding

execute the following query in mysql (via phpmyadmin or command line) to see what the current values are:

select * from core_config_data where path like '%base%url%'; and then update accordingly

update core_config_data set value = 'http://myhostname/js/' where path = 'web/unsecure/base_js_url';