Google search console writes that on my site there is a repeated metadata on several links due to the fact that for some reason it sees links both with parameters and without (CNC):

http://site.ru/?menu=portfolio/gray 

and

 http://site.ru/portfolio/gray 

Here are the settings. Htaccess:

 AddDefaultCharset UTF-8 Options +FollowSymLinks Options -Indexes RewriteEngine On RewriteBase / ErrorDocument 404 /404.php RewriteRule ^index.php$ / [QSA,R=301] RewriteRule ^index.html$ / [QSA,R=301] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)$ /?menu=$1 [QSA,L] 

Where am I wrong? Or what did I do wrong? Help me to understand.

  • Write the canonical address on the pages. - Visman

1 answer 1

This is a congenital disease of the CNC implemented through mod_rewrite. As long as you use it, making only one URL visible from the outside will not work. But, since such a problem has arisen not only from you - a solution for it has long been invented in Google itself.

The simplest option that no longer requires any settings is to train each page to display its correct URL in the HTTP Link header:

 Link: <http://site.ru/portfolio/gray>; rel="canonical" 

It is quite simple to do this because the necessary part of the address is already in the menu parameter - which means that the desired title will easily form your index.php . Just you need to remember to make her url-coding so as not to get HTTP Header Injection:

 $path = implode('/', array_map('rawurlencode', explode('/', $_GET['menu']))) header("Link", "<http://site.ru/$path>; rel=\"canonical\""); 

For a complete list of solutions, see their help center at https://support.google.com/webmasters/answer/139066?hl=en .