Magento and urlencoded urls - magento

I have some links in google like this:
/%3Fcat%3D9%26dir%3Dasc%26limit%3D10%26mode%3Dlist%26order%3Dprice
which equals this link (urldecoded):
/?cat=5&dir=desc&order=price&p=2
If we go by url http://my-shop.com/%3Fcat%3D9%26dir%3Dasc%26limit%3D10%26mode%3Dlist%26order%3Dprice, then Magento shows us 404 error
How can i get Magento redirect those bad urls to their respective urldecoded correct urls?
Magento version 1.7.0.2
Thanks for your time

The problem is the url, not the redirect. I hope this is clear? You have to remove this urls from your shop and from google.
After that, I don't think, there is a good way to do this, because you try to fix an uncommon error.
The magento way might be adding rules to the htaccess or adding the rule to the Magento internal rewrite table, but both solutions don't handle generic rules or regex, which solves this (with the htaccess I'm not sure).
So, I would fix the "bad url creation" problem and hack the index.php at the beginning, check wether such an url is requested, decode it and redirect to the page, die();

Related

How to Redirect urls after index.php in Laravel

We have a classified website developed in Laravel Framework. After analyzing the url structure I am getting the following issue:
Original Url: https://in.mysite.com/female-clothes/mycity
Duplicate Url: https://in.mysite.com/index.php/female-clothes/mycity
Every url is being duplicated as per the example given above.
Please let me know how to fix the above issue.
I think best option would be to 301 redirect Duplicate url to the Original url.
Please let me know the htaccess rule to fix the issue.
Do you know which version of laravel?
From what you've said this could be happening in the server (htaccess) or the application (laravel).
Laravel is able to handle url manipulation and redirection. The routing logic is usually found on the file called web.php (router.php for older version). It seems that the string 'index.php' is being inserted in the middle of your urls so look for it there.
If it's not happening in Laravel it could be in the htaccess, so look there as well.

Can I create a 301 redirect from www.xcompany.com to shop.xcompany.com?

I work for xcompany. I am wondering if it is possible to set up a 301 redirect from our site http://shop.xcompany.com/ to our site http://www.xcompany.com/ and if possible, what would the rewrite rules be?
The old page that existed on the former URL has been removed from the site and a similar page has been created on the latter URL and we need to make sure any traffic is directed to the new page.
Thanks!!
RewriteRule ^old/URL/path$ http://example.com/new/path [R=301,L]
To redirect from oldsite.com to newsite.com you can use the following redirect in /oldsite/.htaccess
Redirect 301 / http://newsite.com/
Redirecting one domain to another domain is very much easier than before only if you are well familiar with CMSs like WordPress. There are plenty of redirect plug-ins available in WordPress that make our efforts easier and quicker.
301 redirection must be done if you have made any changes to the older URL and it will give link juices without losing its ranking, backlinks, and all others.
You need not worry about anything. Redirect your older one to new one. Then Google webmaster tool will give a report if your new site causes crawling errors. Hope it'd be helpful.

Magento : Allow URL as parameter

I am integrating Bazaarvoice in Magento for Ratings and Reviews.
My issue is Bazaarvoice is redirecting to My site with some additional parameter in URL and it turns in to 404 error. I have contacted Bazaaevoice and they told me that Magento may not allow url as a parameter.
www.mysite.com/bazaarvoice?pid=4801-05E&bvdisplaycode=7529-en_us&bvappcode=rr&bvproductid=4801-05E&bvpage=http://abcd.ugc.bazaarvoice.com%2Fbvstaging%2F7529-en_us%2F4801-05E%2Fsubmitreview.htm%3Fformat%3Dembedded%26campaignid%3DBV_RATING_SUMMARY_ZERO_REVIEWS%26sessionparams%3D__BVSESSIONPARAMS__%26&bvcontenttype=REVIEW_SUBMISSION&bvauthenticateuser=false
IS there any solution that i can make the Magento to allow URL as a parameter.
Thanks
I dont think the issue is the parameter because this work
http://demo.magentocommerce.com/?pid=4801-05E&bvdisplaycode=7529-en_us&bvappcode=rr&bvproductid=4801-05E&bvpage=http://abcd.ugc.bazaarvoice.com%2Fbvstaging%2F7529-en_us%2F4801-05E%2Fsubmitreview.htm%3Fformat%3Dembedded%26campaignid%3DBV_RATING_SUMMARY_ZERO_REVIEWS%26sessionparams%3D__BVSESSIONPARAMS__%26&bvcontenttype=REVIEW_SUBMISSION&bvauthenticateuser=false
I think the issue maybe because you dont have this controller in your magento site
bazaarvoice
Does this url work or do you get a 404?
www.mysite.com/bazaarvoice

Magento mini search form from secure pages

I've run into a catch-22 with the search form that hopefully someone can help me with. From any of the secure pages in our Magento store (My Account, Checkout, etc) if you use the mini search form in the header, it takes you to a secure search results page https://oursite.com/catalogsearch/result. This results in a browser warning because there is unsecure content on that page. I thought I could fix this by modifying the CatalogSearch Helper class so that the getResultUrl functions always returns an http: link. However, this results in the browser warning you that you are about to send form data over a non-secure connection. So I can't seem to find a solution that doesn't look dangerous to the user.
Any ideas?
I know this is not the proper EAV/MVC/1000 lines of XML Magento module way of doing it, however, since this is a straightforward http/https problem you can put a couple of lines in .htaccess to get your search box behaving correctly:
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^catalogsearch http://www.example.com/catalogsearch/ [R=301,L]
The right way to fix this is not to use mixed content on that page. Magento can usually handle any page over HTTPS if it is requested to do so, so find the assets that are hardcoded over http:// and fix them to respect the current protocol properly.
For me the incorrect url got stuck in cache (we had heavy cache on the live server) and that caused the security warning for me. Hope this helps someone.
The question should be - why is this happening?
Doing a search on a non-secure page will yield results on a non-secure page.
After having visted a secure page, searching on a non-secure page will yield results on a secure page - how does this make any sense? What is the purpose of this?

Magento Homepage Keeps on redirecting to a 404 page

I have been on this issue for almost a week now and have been research all over the net for answers but i could not find one.
Problem:
each time i access the homepage of my site, it results to a 404 error.
ex.
http://www.domain.com ---> redirects to 404
http://www.domain.com/home ---> enters to the cms page that i set as my homepage
I have already run the magento cleanup scripts but it was not able to solve the problem.
ERROR MESSAGE:
Whoops, our bad...
The page you requested was not found, and we have a fine guess why.
If you typed the URL directly, please make sure the spelling is correct.
If you clicked on a link to get here, the link is outdated.
What can you do?
Have no fear, help is near! There are many ways you can get back on track with Magento Store.
Go back to the previous page.
Use the search bar at the top of the page to search for your products.
Follow these links to get you back on track!
Store Home | My Account
I've got a similar error and would like to post my solution here. The case was exactly the same for me: all the pages, categories, etc. worked perfectly, but the home page showed a 404 error.
I looked into the core_url_rewrite table and discover that there was an entry with the «request_path» field empty. So this entry was rewriting my base url and that was the reason for the 404 in my case. I just deleted it.
Hope this helps to other people.
If you are using the Enterprise version you should check the table enterprise_url_rewrite. The query below should help you:
select * from enterprise_url_rewrite where request_path="";
delete from enterprise_url_rewrite where request_path="";
Check the folowing:
1- System->Configuration->general->Web->secure
Base URL: http://www.your-site.com/
(be sure you are in the right shop site from the top left of the system)
2- System->Configuration->general->Web->Default Pages
Default Web URL: cms (yes just cms)
CMS Home Page: select your cms page
Default No-route URL: cms/index/noRoute
3- check your server has rewrites otherwise
System->Configuration->general->Web->Search Engines Optimization
Use Web Server Rewrites: No
4- something wrong with your .htaccess replace the file with the one in your original installer.
Because StackOveflow has this stupid rule that I must have a certain number of "points" before I can chime in on discussions I need to make this as a "new answer":
open-ecommerce.org's #2 also solved the problem for me
2- System->Configuration->general->Web->Default Pages Default Web URL:
cms (yes just cms) CMS Home Page: select your cms page Default
No-route URL: cms/index/noRoute
for me this was set to "index". No clue how it worked before, or why it was set that way, but after updating it broke and this was the fix for me.
Note that I did also truncate the 'core_url_rewrite' table as well in troubleshooting. If you don't change urls at all, or often, then that's no big deal. But if you are chaning URLs often, then you'll loose your 301 redirect history (all old urls will 404 going forward).
Open-ecommerce.org solution # 2 , worked for me.
I initially set my "Defaul Web URL" as the URL of the homepage. Similar to what I did with the baseURL but I was wrong.
I changed it to "CMS"
From there, it all works.
Thanks!

Resources