[SOLVED] Forms redirecting to wrong port when using HTTPS

Discussion in 'Troubleshooting' started by riccardo, May 24, 2016.

Thread Status:
Not open for further replies.
  1. riccardo

    riccardo New Member

    Joined:
    May 19, 2016
    Messages:
    13
    I'm posting this here in case someone else has this problem, which I have just worked around with the help of the support guys.

    The problem was the following: every time a user submitted a form on my aMember PRO site, they were redirected to the wrong URL.

    For instance, submitting the first page of my signup form SHOULD have brought the user to
    https://example.com/user/signup?_qf_page-1_display=true
    but the browser tried to reach
    https://example.com:80/user/signup?_qf_page-1_display=true
    instead.

    I'll leave the technical details out and jump straight to the solution I found after Andrey Yerokhin of aMember support team pointed me to the cause of the problem.

    I just had to edit my site.php file, adding the following lines at the bottom:
    PHP:
    if (!empty($_SERVER['HTTPS']) && ('off' != strtolower($_SERVER['HTTPS'])))
        
    $_SERVER['SERVER_PORT'] = 443;
    The file site.php should be in folder application/configs under your aMember PRO installation folder.
    If there's no application/configs/site.php file in your installation, just copy application/configs/site-dist.php to application/configs/site.php and add the above lines to the latter.

    Hope this may be of use to someone else in the future.

    All the best
    Ric
    caesar likes this.
Thread Status:
Not open for further replies.

Share This Page