Ho appena reindirizzato il mio sito da http a https utilizzando la seguente regola di riscrittura htaccess
Il mio sito web si trova in una cartella sotto public_html. Diciamo che il nome della cartella sia "mySitefolderName"
RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com$
RewriteRule ^/?$ "https://www.mysite.com/mySitefolderName/" [R=301,L]
Con questa regola, ho ottenuto il reindirizzamento del mio sito da http a https, ma i vecchi link su Google alle sottodirectory in "mySitefolderName" non vengono reindirizzati
per esempio diciamo che ho questo vecchio link su Google: mysite.commySitefolderNamesomeSitePage.php
Se seguo questo collegamento da Google, continua comunque con http
Come posso assicurarmi che anche tutti i vecchi collegamenti alle sottodirectory vengano reindirizzati a https?
risposte:
0 per risposta № 1Aggiungi questa regola /mySitefolderName/.htaccess
:
RewriteEngine On
# add https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=302,L]
# add www
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=302,L]