Htaccess Redirection 301 serveur OVH
Bonjour,
J'ai un souci avec mon fichier .htaccess pour faire mes redirections sachant que mon hébergeur est OVH (serveur apache si j'ai tout compris...)
Ce que je cherche à faire :
Rediriger toutes les adresses suivantes :
nom-domaine
nom-domaine.fr
nom-domaine.com
https://www.nom-domaine.fr/
http://www.nom-domaine.com/
nom-domaine.fr/index.html
nom-domaine.com/index.html
https://www.nom-domaine.fr/
http://www.nom-domaine.com/
https://www.nom-domaine.fr/
http://www.nom-domaine.com/
vers :
https://www.nom-domaine.fr/
ce que j'ai tenté (quelques exemples) :
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^nom-domaine\.fr$ [NC]
RewriteRule ^/(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} #domaine\.[fr|com]$# [NC,OR]
RewriteCond %{HTTP_HOST} #index\.html$# [NC,OR]
RewriteRule ^\(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} #nom-domaine\.[fr|com]$# [NC,OR]
RewriteCond %{HTTP_HOST} #nom-domaine\.[fr|com]/index\.html$# [NC,OR]
RewriteRule ^/(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} nom-domaine\.[fr|com]$ [NC,OR]
RewriteCond %{HTTP_HOST} nom-domaine\.[fr|com]/index\.html$ [NC,OR]
RewriteRule ^/(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
J'ai parcouru une bonne douzaine de tuto sur les regex (voir ci-dessus ce que j'en ai tiré) mais rien ne fonctionne... (quand ça ne fait pas une erreur 500...)
Quelqu'un aurait-il la solution ??
Merci
J'ai un souci avec mon fichier .htaccess pour faire mes redirections sachant que mon hébergeur est OVH (serveur apache si j'ai tout compris...)
Ce que je cherche à faire :
Rediriger toutes les adresses suivantes :
nom-domaine
nom-domaine.fr
nom-domaine.com
https://www.nom-domaine.fr/
http://www.nom-domaine.com/
nom-domaine.fr/index.html
nom-domaine.com/index.html
https://www.nom-domaine.fr/
http://www.nom-domaine.com/
https://www.nom-domaine.fr/
http://www.nom-domaine.com/
vers :
https://www.nom-domaine.fr/
ce que j'ai tenté (quelques exemples) :
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^nom-domaine\.fr$ [NC]
RewriteRule ^/(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} #domaine\.[fr|com]$# [NC,OR]
RewriteCond %{HTTP_HOST} #index\.html$# [NC,OR]
RewriteRule ^\(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} #nom-domaine\.[fr|com]$# [NC,OR]
RewriteCond %{HTTP_HOST} #nom-domaine\.[fr|com]/index\.html$# [NC,OR]
RewriteRule ^/(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} nom-domaine\.[fr|com]$ [NC,OR]
RewriteCond %{HTTP_HOST} nom-domaine\.[fr|com]/index\.html$ [NC,OR]
RewriteRule ^/(.*) https://www.nom-domaine.fr/$1 [QSA,L,R=301]
J'ai parcouru une bonne douzaine de tuto sur les regex (voir ci-dessus ce que j'en ai tiré) mais rien ne fonctionne... (quand ça ne fait pas une erreur 500...)
Quelqu'un aurait-il la solution ??
Merci
Configuration: Windows XP Firefox 2.0.0.16
2 réponses
-
Juste comme cela
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domainepardefaut\.fr$ [NC]
RewriteRule ^(.*)$ http://domainepardefaut.fr/$1 [R=301,L]
https://alexandre.alapetite.fr/doc-alex/redirections/index.fr.html -
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(nom-domaine\.fr)(:80)? [NC]
RewriteRule ^(.*) https://www.nom-domaine.fr/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(nom-domaine\.com)(:80)? [NC]
RewriteRule ^(.*) https://www.nom-domaine.fr/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.nom-domaine\.com)(:80)? [NC]
RewriteRule ^(.*) https://www.nom-domaine.fr/$1 [R=301,L]
J'espère que ça marche pour vous.