Google webmasters duplicate description due to .php extension [closed]
-
18-06-2021 - |
Question
Google webmasters tool is showing me 26 duplicate pages because you can access the page in both ways: /crossMaker.php?jsonID=103 /crossMaker?jsonID=103
In my htaccess file i made it possible not to include the php extension but probably somewhere in the code i linked to the filename with the suffix so google crawled it.
What can i do so that google will forget about the file with the extension? use 301 redirect? if so how do i do that?
La solution
Just use canoncial URLs. It's much easier and the proper way to handle this.
For example, put this at the top of the page:
<link rel="canonical" href="http://www.example.com/crossMaker?jsonID=103" />
You can create these dynamically so it should be easy for you to implement.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow