1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to forward https:// to http:// via .htaccess on wordpress

Discussion in 'PHP' started by infogle, Dec 2, 2015.

  1. #1
    Hello guys...

    I have an issue with my domain previously it was SSL enabled but now i have cancel the SSL but still https:// pages are saved in the google - so my issue is how can we redirect https:// to normal http:// location

    Please help me in this regard...
     
    infogle, Dec 2, 2015 IP
  2. dblane4

    dblane4 Member

    Messages:
    27
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    28
    #2
    This should work:
    RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
    Code (markup):
     
    dblane4, Dec 2, 2015 IP
  3. infogle

    infogle Prominent Member

    Messages:
    2,732
    Likes Received:
    128
    Best Answers:
    1
    Trophy Points:
    300
    #3
    It is not working...
     
    infogle, Dec 9, 2015 IP
  4. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #4
    Try this:

    
    Options +FollowSymlinks
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    RewriteCond %{SERVER_PORT} ^443$
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
    
    # BEGIN WordPress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    </IfModule>
    
    Code (markup):
    Source: http://stackoverflow.com/questions/3717799/redirecting-https-to-http-via-htaccess
     
    qwikad.com, Dec 9, 2015 IP
  5. Nathan Malone

    Nathan Malone Well-Known Member

    Messages:
    369
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #5
    It's not possible unless you have an SSL certificate installed, because the lack of an SSL certificate on a https:// (secure) connection would trigger an error before the server has a chance to respond with the 301 or 302 redirect.

    If you have an SSL certificate, it's possible, but then again, you probably wouldn't want to redirect from https to http in that case.
     
    Nathan Malone, Dec 15, 2015 IP
  6. AdConjure

    AdConjure Active Member

    Messages:
    57
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    65
    #6
    You could always try cloudflare's free plan. They offer free https and you can set it through their "page rules".
     
    AdConjure, Dec 16, 2015 IP
  7. best_services

    best_services Active Member

    Messages:
    557
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    78
    #7
    hey there i don't think it will work with htaccess but you could try using php inside the header page something like this:
    $visitor = json_decode($_SERVER['HTTP_CF_VISITOR']);
    if($visitor->scheme != 'https') {
    $redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $redirect");
    }

    so the same you could modify so you redirect https to http:
    $visitor = json_decode($_SERVER['HTTP_CF_VISITOR']);
    if($visitor->scheme == 'https') {
    $redirect = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $redirect");
    }
     
    best_services, Dec 20, 2015 IP