A
A
Andrej Sharapov2019-08-05 11:28:26
htaccess
Andrej Sharapov, 2019-08-05 11:28:26

Why do duplicates appear?

Hi all!
The site is static, worked stably for a long time.
.HTACCESS

DirectoryIndex index.html
AddDefaultCharset utf-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
    RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]
    
    RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]{2,4}
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule ^(.*)$ $1.html
</IfModule>

Page addresses are displayed without .html , but recently Yandex.Webmaster began to receive notifications about duplicate pages with .html addresses. The duplicates themselves in the search through host: I did not find.
Redirects like:
Redirect 301 /partners.html http://site.ru/partners
just closed the pages, without any redirection...
Tell me, what did you do wrong, how could it happen and how to remove the duplicates?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-08-05
@Madeas

DirectoryIndex index.html
AddDefaultCharset utf-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.site\.ru$ [NC]
    RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]

    RewriteCond %{THE_REQUEST} "^\S+ ([^ ?]+)\.html"
    RewriteRule ^ %1 [R=301,L]
    
    RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]{2,4}
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule ^(.*)$ $1.html [L]
</IfModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question