سلام
اگر برای اجبار به ssl نیاز دارید
کد .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteEngine On
RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://example.com/$1 [R,L]
این هم کد php
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://example.com/newpage.html");
exit();
?>