Link to home
Start Free TrialLog in
Avatar of smetterd
smetterdFlag for United States of America

asked on

If request on port 80, auto redirect to 443 equivalent - Moodle Course Management System

2.1 Installation of Moodle on a supported virtualmin server running Ubuntu Server 10.04 LTS

I have config file to say that the URI root should be https://mobilek16.net

When users put http://mobilek16.net, they get the error I have shown in screenshot.

I want to auto redirect them if the come in on port 80 but I can't get it to work.

I tried adding at top of index.php something like

<?php
if ($_SERVER['SERVER_PORT']<>443) {
header('Location: https://mobilek16.net');      
}
      ?>

But it is not working either.

Any assistance will be greatly appreciated ;-)
Avatar of smetterd
smetterd
Flag of United States of America image

ASKER

User generated image
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Gorgeous... didn't try the second suggestion b/c the first one works!