我在使用 Google Search Console 时遇到问题。它似乎无法正确重定向我的网页,因此覆盖范围它返回一些'重定向错误' 但事实不应该如此。
假设链接如下:https://example.com/name
浏览器重定向到:https://example.com/name/
Search Console 无法做到这一点,因为它会显示持久的“重定向错误“”。
如果我们假设这是 Search Console 中的一个错误,我们会尝试取消索引那些不规范的页面。我们会得到什么结果?现在 Search Console 重定向到规范页面,因此它会取消索引好的页面!!!我的网站是域属性,那里有更多'重定向错误“”。
这是我的.htaccess:
# Redirect HTTP to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# Remove www subdomain
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
# Remove index.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1 [R=301,L]
</ifModule>
# Remove multiple slashes from URL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]
</ifModule>
<IfModule mod_mime.c>
AddType font/otf otf
AddType font/ttf ttf
AddType font/woff woff
AddType font/woff2 woff2
AddType application/vnd.ms-fontobject eot
AddType image/svg+xml svg svgz
</ifModule>
<ifModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jp2 "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresDefault "access plus 1 month"
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
</ifModule>
# Allow access from all domains for web fonts
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttf|woff|woff2)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
Header set Strict-Transport-Security: max-age=31536000
# Reduce MIME type security risks
<IfModule mod_headers.c>
Header set X-Content-Type-Options "nosniff"
</IfModule>
# Server-side technology information
<IfModule mod_headers.c>
Header unset X-Powered-By
</IfModule>
# Server software information
ServerSignature Off
# Disallow usage in an embed code. Items must be hyperlinked
<IfModule mod_headers.c>
Header set X-Frame-Options: DENY
</IfModule>
# XSS protection
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
# Set the referrer policy
<IfModule mod_headers.c>
Header always set Referrer-Policy "no-referrer-when-downgrade "
</IfModule>
# This is for gzip, which compresses files
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
有什么问题吗?我的重定向是否太多?这是 Search Console 错误吗?请检查我的配置。
http URL 也会发生同样的情况,当它应该找到 https 版本时却返回“错误重定向”。
我的网站是用 Jekyll 构建的。