The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

307 Internal Redirects Issue

Discussion in 'General Discussion' started by aadipop, Jan 13, 2017.

Tags:
  1. aadipop

    aadipop Registered

    Joined:
    Jan 26, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Cluj-Napoca
    cPanel Access Level:
    Root Administrator
    Hello,

    I have an account with https

    If I try to access
    Code:
    http://example.com
    i get :

    Code:
    [*]Request URL: http://example.com
    [*]Request Method: GET
    [*]Status Code: 307 Internal Redirect
    
    [*]Response Headers
    
    [*]Location: [URL='https://example.com/'
    [*]Non-Authoritative-Reason: HSTS
    
    If I try to access
    Code:
    http://example.com'
    i get first redirect:
    Code:
    [*]Request URL:http://www.example.com/
    [*]Request Method:GET
    [*]Status Code:307 Internal Redirect
    
    [*]Response Headers
    
    [*]Location:[URL]https://www.example.com/
    [*]Non-Authoritative-Reason:HSTS
    
    and second redirect :
    Code:
    [*]Request URL:[URL]https://www.example.com/
    [*]Request Method:GET
    [*]Status Code:301 Moved Permanently (from disk cache
    
    [*]Response Headers
    
    [*]Content-Length:229
    [*]Content-Type:text/html; charset=iso-8859-1
    [*]Date:Fri, 13 Jan 2017 11:55:19 GMT
    [*]Location:https://example.com/
    [*]Server:Apache
    
    How can i get every time only one 301 redirect ?

    Like
    Code:
    1.http://example.com/
    2.http://www.example.com
    3 https://example.com/
    4.https://www.example.com
    
    only one 301 redirect for
    1 » 3
    2 » 3
    4 » 3

    I try to write some rules in .htaccess file but without any effect

    Code:
    #RewriteEngine On
    #RewriteCond %{HTTPS} off
    #RewriteRule ^(.*)$ [URL]https://%[/URL]{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    RewriteCond %{HTTPS} off               [OR]
    RewriteCond %{HTTP_HOST} ^www\.(.+)$   [NC]
    RewriteRule ^ [URL]https://%1%[/URL]{REQUEST_URI} [R=301,L,NE]
     
    Thanks.
     
    #1 aadipop, Jan 13, 2017
    Last edited by a moderator: Jan 13, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page