Redirect A Single Page To HTTPS Using mod_rewrite

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ <a href="http://www.example.com/$1" >http://www.example.com/$1</a> [r=301,nc]

rewritecond %{SERVER_PORT} !^443$
rewriterule ^filename.php(.*)$ <a href="https://www.example.com/filename.php$1" >https://www.example.com/filename.php$1</a> [r=301]

source

Leave a Reply