Opencart - How to remove "en-gb" from url - .htaccess

I've installed 4.0.1.1 version from OC website.
I'm setting the shop to be available in only one country - UK and only one language English.
I wanted to remove "en-gb" from the url.
Example
myshop.co.uk/en-gb/catalog/books
should be
myshop.co.uk/catalog/books
I've done some searching and as suggested I've removed all zones and countries except UK but this doesn't solve the issue.
How do I get rid of "en-gb" from all urls? Can it be done from .htaccess if yes how?

Related

Rewrite condition to remove specific parameter in Prestashop

I have around 1000 categories created in prestashop and I have SPSEARCHPRO module installed. This module enables me to live search though my products.
Live search doesn't work due to the high number of categories but if I search normally it doesn't work either because the cat_id are included in the link and the link is too long. I suppose that's why the live search doesn't work either.
Here is what I'm trying to do:
I have this link:
https://example.com/en/module/spsearchpro/catesearch?fc=module&module=spsearchpro&controller=catesearch&orderby=name&orderway=desc&cat_id=2%2C4%2C(etc etc etc etc etc)
how can I remove the cat_id parameter from the link because the value is too long, it includes all the category id's.
I'm on prestashop 1.6.1.9 with multistore enabled (I don't know if that matters).
Putting this early in your .htaccess should cut out the unwanted parameter when the path ends with the category search slug, you may need to add other slugs to that if there are more affected pages.
RewriteCond %{QUERY_STRING} ^(.*?&)?cat_id=(?>[^&]*)(?:&(.*))?$
RewriteRule ^.*/catesearch$ /$0?%1%2 [NS,DPI,PT]
You may have to use L,R instead of DPI,PT flags if PrestaShop doesn't trust the $_GET it starts with (which comes from the rewritten URL). I'm unsure because it looks like it re-parses the URL from $_SERVER['REQUEST_URI'] which is unchanged by rewriting and would overwrite the corrected parameters with the original undesired ones. It may be the only way to make it work is an external redirect.

comma in the URL , google ignore all after comma

My site have links contains comma. eg. http://example.com/productName,product2123123.html
I set sitemap of this links and google webmaser tools report information that url is not found.
I see google ignore all after comma in url and try index http://example.com/productName that is error url and site generate 404.
Google have bug ? or i must change routing of my site ? or change comma to "%2C", but this could remove my actual offer from google ?
I'm not sure if this could help you but maybe this could help you understand more of what your problem is. Try reading the following links:
Using commas in URL's can break the URL sometimes?
Are you using commas in your URLs? Here’s what you need to know.
Google SEO News and Discussion Forum

my mistake caused bad links on SE howto resolve it?

I made mistake in .htaccess on my site with following codes :
RewriteRule ^articles/isfahan_articles([0-9]+).html$ ./maghalat.php?id=$1
That it seems it have changed my links on Google and other search engines from:
siteaddress/articles/isfahan_articlesXXX.html
to :
siteaddress/maghalat.php/isfahan_articles108.html?id=108
how can I change my links on SE to old style:
siteaddress/articles/isfahan_articlesXXX.html
Note: I have changed my .htaccess to :
RewriteRule ^articles/isfahan_articles([0-9]+).html$ maghalat.php?id=$1
But my issue is still exist.
Google doesn't have a live version of your website - it visits it periodically and stores the results. So it will take a few days after you revert your URLs before they will be updated in google.
You can speed this up by submitting a Sitemap or increasing the Crawl Speed at:
https://www.google.com/webmasters/tools/

mod_rewrite caused drop my ranking

I'm owner of http://myisfahan.com. I have an article management system there that developed by myself.
Recently I changed article links from myisfahan.com/articles/isfahan_articleXXX.html to myisfahan.com/XXX_[article subject].html in newer version. Many of my articles had high ranking on Google (in Persian language).
Because I didn't know redirect older links to newer one I only wrote 2 instruction only in the .htaccess:
RewriteRule ^([0-9]+)_([^/\.]+).html$ maghalat.php?id=$1
RewriteRule ^articles/isfahan_articles([0-9]+).html$ maghalat.php?id=$1
After this major change Google.com dropped many of my page rankings and recently I have only 20% of normal site visitors.
My questions are:
Does this changes caused this drop of ranking, because in fact now I have 2 links for every content .
I fetch subject text by PHP and generate XXX_[article subject].html, how can I write a rewrite syntax that redirect isfahan_articlesXXX.html to XXX_[article subject].html file when XXX is article's ID in .htaccess file?
You should have 301 redirected your old links to your new links, after creating your new links.
If you did not or are duplicating links to the same content, this would indeed hurt your rankings.
UPDATE
Looks like you already have the RewriteRules in place that you need. Just add the following flags (note the 301 redirect for the old links) and over time it should (over time) rebuild your page rank.
RewriteRule ^([0-9]+)_([^/\.]+).html$ maghalat.php?id=$1 [L]
RewriteRule ^articles/isfahan_articles([0-9]+).html$ maghalat.php?id=$1 [R=301,L]

SEO - Problems possibly related to 301 Moved Permanently

Right, here's the story:
We have had a website for one of our brands now for many years, the site design was very bad and recently did a complete overhaul, mostly design, but also some of the backend code.
The original site was using links such as this example.com/products/item/127 and thus I wanted to change them to be move user friendly, especially to include the product name, the same link now reads example.com/product/127/my-jucy-product/.
Since our switch over we have seen our Google results take a beating (we were on the first page for our normal search terms, now we're nearer the 4th!). The other problem we're having is that the links to the old products haven't updated to the new links despite me coding a 301 redirect from old to new. The 301 is not being fired from .htaccess, but in our PHP framework.
I had a look at how the site is being loaded from a old link that is still in Google and here's what firebug is reporting:
GET <google link> 302 Found
GET example.com/products/item/127 302 Found
GET example.com/products/item/127 301 Moved Permanently
GET example.com/product/127/my-jucy-product/ 302 Found
So the Google link has a 302, good. But when the old link comes in our framework is returning a 302! It's only afterwards when it finally hits the right part of the framework does it 301, so here's my question:
Is the reason our old links have not changed and our Google Ranking has significantly nose dived because Google is seeing a 302 before the 301?
At the time I was reluctant to mess with our .htaccess because it had become pretty complicated and I was under some pretty intense time constraints, now I'm wondering whether this was an incorrect disicion and perhaps I should revisit it.
Many thanks!
Edit
Bugger, just signed up to the Webmaster Tools and I'm getting redirect errors all over the place, hundreds of them! I think this is my problem.
Edit 2
So on closer inspection it looks as if it is because I was being lazy and not using .htaccess to redirect my URLs, I wanted to avoid doing this as it was easier at the time just to throw a PHP header, regardless I have now started convert our framework to depend more on the .htaccess, not only has this solved the problem (well, we'll see when I get a google crawl) but it has also improved the speed dramatically!
One thing to look at is canonical links (which is how SO does it). This means you don't need to do redirects, old links will still work and search engines will get updated accordingly.
http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
There's no telling how Google will adjust its PageRank witch's brew on a day to day basis, but in general, you should expect to see a (temporary) drop in PR following a mass 301 redirect of legacy URLs. It often just takes a little time (a month, maybe two) for things to percolate.
Note this does not answer your question about whether the 302 is hurting you. Just pointing out that, even if it's not hurting you, you should still see a drop in PR temporarily, on the basis of the mass 301 redirect alone.
I think noone except of google can answer your question with 100% confidence.
302 temporary redirect most probably prevents google to update the old link to new one and this situation COULD have effect on page ranks.
I'd first of make sure that all old pages are accessible and redirected immediately with 301.

Resources