Magento secure urls

Magento secure urls : Enable secure url from backend for frontend and for admin

System -> Configuration -> GENERAL -> Web -> Secure -> Use Secure URLs in Frontend = Yes

System -> Configuration -> GENERAL -> Web -> Secure -> Use Secure URLs in Admin = Yes

Get secure url

<?php 
Mage::getBaseUrl('url', $secure = true);
?>

Check if you are on secure url or not with magento code

<?php 
if (Mage::app()->getStore()->isCurrentlySecure()) {
    echo 'Current URL is Secure';
} else {
    echo 'Current URL is NOT Secure';
}

?>