0

I'm writing because I have a problem that I can't find a solution to. Google Search Console tells me that my site has over 30 pages in the "Page crawled, but not currently indexed" section. All these pages have URLs like:

https://www.example.com///page.html

To try to solve the problem I had added this integration to my .htaccess:

#remove double/more slashes in url 15-05-2024
<IfModule mod_rewrite.c>
RewriteBase /
# Rule 1: remove multiple leading slashes (directly after the TLD)
RewriteCond %{THE_REQUEST} \s/{2,}
RewriteRule (.*) $1 [R=301,L]
# Rule 2: remove multiple slashes in the requested path
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
RewriteRule (.*) %1/%2 [R=301,L]
</IfModule>

Google Search Console tells me the problem is not solved. My current .htaccess is this:

# BEGIN All In One WP Security
#AIOWPS_BASIC_HTACCESS_RULES_START
<Files .htaccess>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
ServerSignature Off
LimitRequestBody 10485760
<Files wp-config.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
#AIOWPS_BASIC_HTACCESS_RULES_END
#AIOWPS_DISABLE_INDEX_VIEWS_START
Options -Indexes
#AIOWPS_DISABLE_INDEX_VIEWS_END
#AIOWPS_DISABLE_TRACE_TRACK_START
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
#AIOWPS_DISABLE_TRACE_TRACK_END
#AIOWPS_PREVENT_IMAGE_HOTLINKS_START
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.*)?\.corsiinformaticatreviso\.com [NC]
RewriteRule \.(gif|jpe?g?|png)$ - [F,NC,L]
</IfModule>
#AIOWPS_PREVENT_IMAGE_HOTLINKS_END
# END All In One WP Security

Options +FollowSymLinks
RewriteEngine on
Redirect 301 /page1.html https://www.mydomain.com/page1/
Redirect 301 /page2.html https://www.mydomain.com/page2/
Redirect 301 /page3.html https://www.mydomain.com/page3/ --> and so on with oltre 30 URLS

RewriteCond %{ENV:HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
#This Apache config file was created by Duplicator Installer on 2020-09-08 07:27:18.
#The original can be found in archived file with the name .htaccess__[HASH]

#Begin Really Simple Security
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

#End Really Simple Security
# BEGIN WordPress
# Le direttive (linee) tra "BEGIN WordPress" e "END WordPress" sono
# generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori verrà sovrascritta.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I will be grateful if you could give me some information to solve the problem.

2
  • Is your site indexed at all (other canonical URLs)? "to solve the problem I had added this integration to my .htaccess" - You need to find where these erroneous URLs are coming from to begin with (and "fix" those) before implementing a secondary fix in .htaccess. (The problem is not in .htaccess.) Are these erroneous URLs on your site, in your sitemap or linked to from a 3rd party? Implementing a fix in .htaccess is not a solution if your site is linking to these erroneous URLs internally.
    – MrWhite
    Commented May 28 at 11:48
  • Why do you have a stack of Redirect 301 /page1.html https://www.mydomain.com/page1/ directives? That would seem to imply that URLs of the form /page.html are not canonical anyway? You have two different types of HTTP to HTTPS redirect, only one of which is actually doing anything. The second one (which is likely to be the active one) implies you are behind a frontend proxy / CDN?
    – MrWhite
    Commented May 28 at 11:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.