skip to Main Content

Recently I installed SSL. It works fine , but my site doesn’t redirect to https. My server isn’t supporting htaccess file. Is there any other way to do this??

Thanks in advance.

3

Answers


  1. Try This trick once. I am not sure its going right way. Try it and let me know.

    <?php
    
    if ( $_SERVER['HTTPS'] == "" )
    {
        header("HTTP/1.1 301 Moved Permanently");
        header('Location: https://yoursite.com.php');
    }
    
    ?>
    
    Login or Signup to reply.
  2. Now you can do your httpd.conf file or the file where your virtual host is specified and add these lines to redirect http to https:

    <virtualhost *:80="">
    
    ServerName mysite.com
    ServerAlias www.mysite.com
    Redirect / https://<your site name>/
    DocumentRoot /var/www/public_html
    </virtualhost>
    
    Login or Signup to reply.
  3. you can use in if condition

    $_SERVER[REQUEST_SCHEME]!='https'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search