Mettre le code suivant à .htaccess
dans le répertoire principal
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule^https://yoursite.com/$1 [L,R]
#the code above will redirect the entire site into https without www unless the request come with https://www .
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule^https://yoursite.com/$1 [L,R]
#The code above will catch any request with www if passed first code.
RewriteCond %{THE_REQUEST} \s/+(.*?/)?(?:index)?(.*?)\.html[\s?/] [NC]
RewriteRule^/%1%2 [R=302,L,NE]
#the code above will remove any .HTML.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
# you can use the two lines if file without extension not work and you want to map them to .html files and if you want to go the same file .html without extension keep it as it is but , If you want to change it to same name .php file , replace $.html in the last line to $.php .
une chance que vous pouvez expliquer ce que tout fait? aussi cela fonctionnera-t-il encore si j'entre dans le site Web sans "www"? – nathan
testé avec xampp mais obtenir "Votre connexion n'est pas privée" dans google chrome – nathan
Oui, cela fonctionne aussi si vous allez sur le site sans le ** www **. Avez-vous une configuration XAMPP pour gérer les connexions HTTPS? Ce message apparaîtra si vous ne l'avez pas configuré correctement ou si vous n'avez pas de certificat. –