Certificat ssl et redirection 301

Bonjour
J ai créé un fichier htaccess avec une redirection 301 pour afficher mon site en https,
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://wwwmonsite.fr/$1 [R=301,L]
Pas de problème le site s'affiche bien avec https, par contre pour le Référencement je veux refaire une redirection serveur sur le fichier index.html vers pageexemple.html
j ai inséré code php dans mon fichier pageexemple.html mais j ai une page blanche qui s affiche
header("Status: 301 Moved Permanently", false, 301);
header("Location: https://www.monsite.fr/pageexemple.html");
exit();
?>
Conflit de redirection 301 car sans la ligne rewriterule fichier htaccess la page s'affiche correctement mais sans https ou y a t il une autre solution pour afficher https sans passer par fichier htaccess
Merci pour votre aide

pourquoi ne pas tout faire avec le `.htaccess`?
quel site à tester?

Bonjour
En effet on peut modifier fichier access , je croyais que cela nuisait au référencement
donc
RedirectPermanent /index.html https://www.monsite.fr/pageexemple.html
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
mais j aurais bien aimé comprendre pourquoi (culture personnel) fichier index html avec code php rentre en conflit avec fichier htaccess quel etait erreur

&gt; je croyais que cela nuisait au référencement<br /><br />non, le .htaccess n&#39;est qu&#39;un moyen rapide de le faire<br /><br />tu oublies la redirection sur sous-domaine<br />&#96;&#96;&#96;text<br />RedirectPermanent /index.html https://www.monsite.fr/pageexemple.html<br /><br />RewriteEngine On<br /><br />  ## no-www -&gt; www<br />RewriteCond %{HTTP_HOST} !^www\.<br />RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R&#61;301,L,NE,QSA]<br /><br />  ## http -&gt; https<br />RewriteCond %{HTTPS} off<br />RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R&#61;301,L,NE,QSA]<br />&#96;&#96;&#96;<br /><br />ou <br />&#96;&#96;&#96;text<br />   ## pageexemple.html en premier devient prioritaire pour le listage du dossier<br />DirectoryIndex pageexemple.html index.php index.html<br /><br /><br />RewriteEngine On<br /><br />  ## no-www -&gt; www<br />RewriteCond %{HTTP_HOST} !^www\.<br />RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R&#61;301,L,NE,QSA]<br /><br />  ## http -&gt; https<br />RewriteCond %{HTTPS} off<br />RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R&#61;301,L,NE,QSA]<br />&#96;&#96;&#96;

## pageexemple.html en premier devient prioritaire pour le listage du dossier
DirectoryIndex pageexemple.html index.php index.html


RewriteEngine On

## no-www -> www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

## http -> https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]


ok Merci