• Resolved gissagiswara

    (@gissagiswara)


    Recently , I’ve successfully redirect my site from http to https (SSL) , but my site’s redirect using 302 .

    >>> https://ngelag.com
    
    > --------------------------------------------
    > 302 Found
    > --------------------------------------------
    Status:	302 Found
    Code:	302
    Date:	Sun, 14 Feb 2016 03:09:56 GMT
    Server:	Apache
    Location:	https://ngelag.com/
    Cache-Control:	max-age=31536000
    Expires:	Mon, 13 Feb 2017 03:09:56 GMT
    Content-Length:	203
    Connection:	close
    Content-Type:	text/html; charset=iso-8859-1
    
    >>> https://ngelag.com/
    
    > --------------------------------------------
    > 200 OK
    > --------------------------------------------
    Status:	200 OK
    Code:	200
    Date:	Sun, 14 Feb 2016 03:09:57 GMT
    Server:	Apache
    X-Powered-By:	PHP/5.3.29
    Link:	<https://ngelag.com/wp-json/>; rel="https://api.w.org/"
    Vary:	Accept-Encoding,User-Agent
    Cache-Control:	max-age=31536000
    Expires:	Mon, 13 Feb 2017 03:09:57 GMT
    Connection:	close
    Content-Type:	text/html; charset=UTF-8

    i like to move my site permanently to https:// (301) how to do this ?

    I’ve tried using these code , but the result still redirecting my site using 302 .

    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]

    am i doing it wrong ? how to redirect http to https using 301 instead 302 ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Last 3 year ago, I’m using this code for my client site. I don’t know this htaccess code will compatible or not for you. But I think you should try.

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://domain.com/$1 [R,L]

    Good luck!

    Thread Starter gissagiswara

    (@gissagiswara)

    @v123hine
    thank for your help , but the code that you give doesn’t make any change , i dont know why , my site still redirect from http to https using 302 rule .

    recently i try new code :

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    </IfModule>

    and finally my site redirect from http to https using 301 rule .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to redirect http to https using 301 instead 302 ?’ is closed to new replies.