HTACCESS 301 redirect to solve redirect error in google search console?

172 views Asked by At

Do you have any idea why google search console gives a redirection error? I've been trying to solve this problem for days. My website: https://www.energiatanusitvany-budapesten.hu/ I've set up every essential redirection (non-www. to www., with "/" to without "/", with ".html" to without ".html", http:// to https://) Something is wrong with the .html trimming. Search console gives these indexing and redirectional errors: Referral links:https://www.energiatanusitvany-budapesten.hu/energetikai-tanusitvanyhttps://www.energiatanusitvany-budapesten.hu/energetikai-tanusitvany.html

Referral links: http://www.energiatanusitvany-budapesten.hu/adatvedelem.htmlhttps://www.energiatanusitvany-budapesten.hu/adatvedelem

This is how my .htaccess file looks like:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.energiatanusitvany-budapesten.hu/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [NE,R=301,L]

RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]

RewriteOptions inherit

<ifModule mod_headers.c>
    Header set Connection keep-alive

    <filesMatch ".(jpg|jpeg|png|gif|swf|ico|pdf|flv|json|js|css|config_resp|rcb_k36d0|)$">
        Header set Cache-Control "max-age=31536000, public"
    </filesMatch>

<IfModule mod_expires.c>
    ExpiresActive on
 
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<IfModule mod_headers.c>
# Set XSS Protection header
Header set X-XSS-Protection "1; mode=block"
</IfModule>

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s on(s)|offs()
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]
0

There are 0 answers