Url duplication with Prestashop SEO - .htaccess

I have an e-commerce developed with the CMS Prestashop.
Yesterday i have seen in my Webmaster Tools that i had some duplicated URL, like this:
www.mysite.com/manufacturers
www.mysite.com/it/manufacturers.
Where 'it' is the suffix of the default and only language for the website.
I've already activate the friendly URL in the back-office and also I've a .htaccess file generated automatically by the generator in the back-office.
What should I do to fix this issue?
PS: Also I think that I've already taken a penalization from googlebot.

First of all let me clarify the Title from the SEO point of view. The problem is from Prestashop side not from SEO side. It is just affecting your SEO.
Now on the problem, Prestashop is notorious for URL problems. I would not recommend you the .htaccess hack solution because every time you regenerate your .htaccess from you backend, you have to manually insert that hack again in it to keep the problem down. And suppose this url problem arises again after sometime for some other url than you have to do it again. It can turn into a nightmare.
So here are some of my personal recommendations...
If this site is critical(which I am assuming), buy a Prestashop url rewriting module from a trusted provider. You will also get a technical support in case this problem arises again in future.
If you can't buy than I would suggest you to ask this question on Prestashop forums, as this is Prestashop specific, to permanently solve this problem. You will most likely to get more instant answers as you will find more people working on Prestashop there than here.

Somewhere either in the htaccess file in your document root, or in the vhost/server config for mysite.com, you'll need to 301 redirect. Now you just need to choose which one you want to keep, the one with /it/ in front or the one without? Let's say you want to point everything to the one without, you'll use one of these:
Using mod_alias:
Redirect 301 /it/manufacturers /manufacturers
Using mod_rewrite:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mysite.com$ [NC]
RewriteRule ^/?it/manufacturers(.*)$ /manufacturers$1 [L,R=301]

Related

Generating friendly URLs / htaccess from database

The scenario
I have a menu builder (Title, Link...) in PHP/MySQL, which I want to be able to configure the friendly SEO rule in the .htaccess
The issues
Here is a typical rewrite rule at the moment:
RewriteRule ^computer/other-components/?(.*)$ index.php?CategoryID=9&SubCategoryID=2 [NC,L]
I could write all these manually in the .htaccess but there are a couple of issues:
I would have to manually do this each time I want to add/make changes to the page structure
It's really long.
I've read that writing directly to the .htaccess is a no-no for security, so what would be best to implement something like this? Wordpress and similar CMSs do similar, so what is recommended here?

Why doesn't this simple RewriteRule work anymore and why does google keep seeing it?

Some time ago (I think a couple of years) this simple RewriteRule in my htaccess stopped working.
RewriteRule tags/ tags.php [L]
It worked for years, then a day after a server change or a server upgrade or switch to php-fpm (I don't remember) it stopped working.
I solved it by deleting it, and sending all my links directly to the tags.php file.
This rule is part of a small CMS that I use for many of my sites. The sites work and everything works correctly.
But punctually when I create a new site, after a few days google sends me a warning telling me that the url mysite.com/tags/ creates an error 404.
And this is strange, because the url mysite.com/tags/ no longer exists for years now in my sites, nor in my sitemaps, I am sure because it is used only once in the main menu of my sites, and has been replaced with mysite.com/tags.php.
Above all it cannot exist in new sites. At first I didn't pay much attention to it on old sites. Probably google may have seen it in the old sites, and haven't forgotten it yet, but surely can't have seen it in the new sites.
So, I have a couple of unanswered questions.
The first and perhaps most important to understand: How does google see the url mysite.com/tags/? Is it possible that google reads my htaccess to understand what kind of url I'm going to create?
Second: how can I solve the problem permanently?
--------------------------update---------------------
Sorry for the delay with which I reply (summer vacation).
Regarding anubhava's answer, I have a doubt, but it's my fault, maybe I omitted part of the code.
The next rule says:
RewriteRule ^tags-([^/]+)\/$ tags.php?letter=$1 [L]
and makes work some urls like:
mysite.com/tags-k/
and these urls work, but if I put a 301 redirect on tags.php, will they still work?
No, Google (or any other) search bot cannot read your .htaccess
It is difficult to figure out how search bot found /tags URI but it is definitely hidden somewhere in your web pages.
Now to tell search bots that /tags doesn't exist is to use a redirect rule with R=301:
RewriteEngine On
RewriteRule ^tags(/.*)?$ /tags.php [L,NC,R=301]
With this 301 rule search bot will eventually let go old /tags/ result and will remember /tags.php only.

TYPO3 links from non-https to http

Goal: Every non-https link has to become https. Always.
Achieved by now:
Changed base-url to https
Each link is https IF I'm on non-http
My issue is stated at my second achievement. For some reasons the links targets to https if I am on a non-https page, otherwise to http. I know I could implement a work-around using .htaccess but this isn't the clean way and I want to implement it in a clean way.
What I've done to fix it:
I know one can force the protocoll for a single typo3 page and I can update all pages via database but in this case it's not possible as it's a multitree presentation and not every tree have to use https.
I also googled and read about config.baseUrl but I've changed that before I even googled.
On the presentation "Enforce https" having key "https" is installed but I can't find it in the Ext. Repository.
Further stuff:
I guess the issue is not caused by .htaccess but in any case: This in my .htaccess file
RewriteCond %{HTTP_HOST} ^mydomain\.de$
RewriteRule (.*) https://www.mydomain.de/$1 [R=301,L]
Any help is appreciated.
Solution
The solution is to deactivate the Extension "https" which is installed in the TYPO3 presentation. Why? Well, for some reasons the extension replaces/renders the urls as absolute and which is even more weird with "http".
I proceed with the investigation and update the post later on with in depth details.

Too many Rewrite Rules in .htaccess

I had to redesign a site last week. The problem is that last urls weren't seo friendly so, in order to avoid Google penalizing my site because too many 404 errors, I have to create a lot of Rewrite Rules because all the content had awful URL's ( and that content had a good position on SERP's).
For example:
RewriteRule ^documents/documents_for_subject/22-ecuaciones-exponenciales-y-logaritmicas http://%{HTTP_HOST}/1o-bachillerato/matematicas-cc.ss/aritmetica-y-algebra/ecuaciones-exponenciales-y-logaritmicas [R=301,L]
Is this a problem on my performance? Is there another solution to my situation?
Thanks
They are in the same domain.
Then an internal redirect is much better. A header redirect sends the new URL to the browser and causes it to make a new request; an internal one is handled, as the name says, internally.
This should work:
RewriteRule ^documents/documents_for_subject/22-ecuaciones-exponenciales-y-logaritmicas /1o-bachillerato/matematicas-cc.ss/aritmetica-y-algebra/ecuaciones-exponenciales-y-logaritmicas [L]
Any performance issues are going to be negligible with this - except maybe if you have many thousands or tens of thousands of individual rules, those may slow down Apache. In that case, if you have access to the central server configuration, put the rules there instead of a .htaccess file, because instructions in the server config get stored in memory and are faster.
A. Yes using 301 is the right way to notify search bots about changed URLs and eventually your old URL's will be removed from search results.
B. You don't need to use %{HTTP_HOST} in your rewrite rule just use it like this:
RewriteRule ^documents/documents_for_subject/22-ecuaciones-exponenciales-y-logaritmicas http://%{HTTP_HOST}/1o-bachillerato/matematicas-cc.ss/aritmetica-y-algebra/ecuaciones-exponenciales-y-logaritmicas [R=301,L]
C. If you have lots of RewriteRules like above I recommend using RewriteMap or else use some scripting support (like PHP) to redirect from old to new URL with 301.

Changing a website domain and redirecting

We're moving a fairly large website from domain.one where it's been for a long time onto domain.two. If people still find links for domain.one we want them to redirect to an appropriate place on domain.two (if possible).
Domian.one is no longer required after the switch. I don't know anything about moving an entire domain so could use some advice on the best way to go about switching whilst retaining the SEO gained over the years.
Any help is appreciated.
Many thanks
Put this in an htaccess file in your root web directory. It will forward your users, and search engines, to the new URL on the new domain.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
ADD THE FOLLOWING LINES as posted by John .
Also log in to google webmaster tools->configuration->change of address
and change your url ther so that seacrh engine results are also changed.
THIS iS VERY IMPORTANT

Resources