Is there any way to replace "&" with "&" in Magento URL - magento

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?

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]

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';

Related

Prestashop Url change

I have a problem,
I changed the url of my prestashop because I have a new url.
But now i have the Problem that i tipped in the wrong path, and if i want to log in as admin then the shop directs me everytime to the wrong path so I can't change anything...
Does anybody know in which folder of the FTP Server I can change it in the data?
I tired to delete the htaccess data but this didn't help me.
Or is it another option to go back to where I started, before i changed the Url?
I think that your problem occurred not from a .htaccess but from your database. Prestashop keeps domain URL in the DB and if you changed it you better to check table configuration fields PS_SHOP_DOMAIN, PS_SHOP_DOMAIN_SSL and table shop_url. I think that the problem is over there.
When you want to migrate to another server, you have to
Update the _DB_... constants in config/settings.inc.php file
Since your database does not changed, this step is not necessary.
Update PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL fields in configuration database table
Update the domain, domain_ssl and physical_uri fields in the shop_url database table
Now you can log in to the admin page. When you did it, your first step has to go to Preference -> SEO & URLs, then turn off and on again the Friendly URLs switch to update the .htaccess files.
These steps are works on Prestashop 1.6, but not tested on 1.7.
See the official blog post for additional details:
https://www.prestashop.com/en/blog/how-to-migrate-prestashop-to-a-new-server

URL rewrites not working and keep changing the URL extension

I cannot get the URL rewrite in Magento to work correctly at all. I'm trying to redirect a category to a CMS page and at first try it works fine. After I refresh, it starts to change the URL extensions to something completely different than what's shown for the category URL. I've tried clearing the cache and reindexing the URL rewrite but that seems to change it again!
And if I do try to change the URL rewrite to this new, random, made up one that's being automatically inputted - it changes it again! I'm so confused here..
Fixing weird URL Rewrites
Sometimes when you make changes to your products, or enable a certain extension, Magento might start to rewrite all your URLs to include a suffix "-1" or some other number. Within the URL Rewrites, Magento differentiates between System URLs and Custom URLs. If the System URLs are broken like this, you should not fix this by adding new Custom URLs.
Instead, open up phpMyAdmin, create a backup of your Magento database, and flush the Magento table core_url_rewrite (so that it becomes totally empty). Immediately afterwards, refresh the Catalog Url Rewrites under Index Management. This will regenerate all System URLs.
You can also try to redirect through the .htaccess.
Redirect 301 /site-URL-to-redirect www.site.com/url-destination
There are two ways to redirect your category page to cms.
Using Magento native URL rewrite managment.
In Magento 1.x go to
admin -> catalog -> url rewrite managment -> add new url
select custom in Create URL Rewrite: drop down and then give your categoy url as request and cms page as target.
Using .htaccess file. Add this line of code into the file .htaccess:
Redirect category-url cms-page-url

magento Every Product detail page showing 404

I have shifted from live site to local site, the product detail page is showing a 404 page. I tired re-index multiple time.clear cache. check database also but it still displays a 404 page.
There can be several things you can check:-
1. Check for url in core_config_data and also check cookie url.
2. Check on server for mod_rewrite module may be this is not enabled on local, this can also be the reason if you were using SEO friendly url.
Clear the cache once you are done with these. It will be great if you can tell how url for PDP page is been generated on local.
my url is like this
http://localhost/reyassoc/10x-a4-silver-diamond-brochure-island-stand.html
same it working on existing live site
Run below sql query
SELECT * FROM `core_config_data` WHERE path = "web/seo/use_rewrites";
See whether the value 1 or not, if the value is 1, try to change it to 0.
This value is for SEO friendly url, which removes index.php from your store url.
Also, you can replace your .htaccess file with default one in Magento root folder.
Your server may have problem with mod_rewrite module or its configuration, you may re-install it.

Custom URL for Magento's basket page

I'd like to implement custom URL for our Magento's basket. Magento out-of-the-box url paht is /checkout/cart but client request /checkout/bag.
I tried to somehow
* URL rewrite management in backend - it works, but I need to update all occurences in code to new url, because $this->getUrl('checkout/cart') doesnt translate into checkout/bag
* also I tried to follow some advices from http://alanstorm.com/magento_dispatch_rewrites_intro but basicaly it doesnt help me too.
* also I tried example from this post http://phprelated.myworks.ro/two-add-to-cart-buttons-with-different-redirect-actions-at-once-in-magnto/
So, is there any way how can I rewrite translation from path 'checkout/cart' into checkout/bag without updating all ocurrences in our templates and classes $this->getUrl('checkout/cart')
Any solution depending on web server architecture are not the ultimate solution.
I found solution
1) I rewrited model core/url to have desired output
EDIT 1 - sample implementation https://gist.github.com/jaromirmuller/132cdd9378e5b1018170
2) Added url rewrite into config.xml which rewrites url path from /checkout/bag to /checkout/cart
<global>
<rewrite>
<mynamespace_mymodule_checkout_cart>
<from><![CDATA[#^/checkout/bag#]]></from>
<to>/checkout/cart</to>
</mynamespace_mymodule_checkout_cart>
</rewrite>
</global>
3) Added url rewrite into Catalog > URL rewrite management which handles if anyone comes to /checkout/cart then he's redirected to /checkout/bag paht which is correct.
These 3 points makes site consisten and working without any issues. That's the easises way without rewriting tons of templates and classes.
The way Url Rewrites work means that you have some url test.com/some on the page and when you click on it, you'll get test.com/some2 instead. So Rewrites do not change the actual anchor link - they change the destination of that link to the new recipient.
There is no easy solution which will change all of the anchor links to the new ones (aside from parsing and replacing links on each page - which is not preferable).
So if you want to leave anchor links as they are and get the new Url after user clicks on the link, you should go with Url Rewrites. Though if you want to change the actual links on the page, you need to search for all occurrences and change them manually.
Mage::getUrl() is not a fabric which operates with aliases (like Mage::getModel()) - you'll get from it what you have inserted, and the only way to change the outcome Url is to change income parameters.
You can do it using apache url rewrites. Something like
RewriteRule ^/checkout/cart(.*)$ /checkout/bag$1 [R=301,NC,L]
This answer works for changing the wishlist name by changing the frontend routers in app/etc/local.xml. Maybe it can be adapted for your uses?
Change wishlist url in magento
To manage more url translation You can use this module:
http://www.magentocommerce.com/magento-connect/catalog/product/view/id/18160/

Magento installation Problem in plesk

I have installed magento from Plesk,The home is well,with layout buy when I click any link it show "Not Found" message.
I can not figure out the problem
Thanks in advance.
It looks like you have a problem with Apache mod_rewrite.
Anyway, you can check is it true. Let's just say that you where going to open http://www.example.com/electronics and got 404. Ok, no panic. Try to edit URL to be like this: http://www.example.com/index.php/electronics
If it works, than definitely you have a troubles with one of the following:
Apache mod_rewrite is not enabled. If you can open a page with phpinfo(), you may try to search "mod_rewrite" on that page. No results found -- no mod_rewrite... Call your hosting support.
You need to set RewriteBase directive in your .htaccess file (it may be hidden for web based filemanager). By default the line with RewriteBase is commented, and you can uncomment it and leave it's default value "/" if your Magento is uploaded to document root. If your Magento is in some sub-directory under document root, you need to set RewriteBase value lie this "/my_folder_with_magento".

Resources