I launched the WFB Drupal site without a secure certificate on it so all our staff have the non secure “user/login” page bookmarked. Here’s a quick fix to get the login page redirected to https.
- Site Building > Blocks > Add Block
- Give it a meaningful description, and change the Input Format to “PHP Code” then paste the following:
<?
if ($_SERVER["SERVER_PORT"] != 443)
{
header(‘Location: https://www.yoursite.com/user/login’);
}
?>
- Select “Users cannot control whether or not they see this block.”
- Select “Show on only the listed pages.” and put in “user/login” (without the quotes) in the Pages: section.
This approach also works for creating custom text on any Drupal generated pages, all you need to do is create a new block and paste in your HTML following the directions above.
Comments 2
Did you add anything to your apache config, what other changes did you have to make?
Posted 02 Feb 2012 at 11:46 am ¶Sorry for the late response… don’t check on the blog that much. You want to use a plugin called Secure Pages, much better solution that what I originally posted here. No apache config or drupal config changes made.
Posted 17 Feb 2012 at 12:01 am ¶Post a Comment