1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with 301 redirect .htaccess

Discussion in 'BlackHat Lounge' started by azen068, Aug 27, 2016.

  1. azen068

    azen068 Junior Member

    Joined:
    Jan 29, 2014
    Messages:
    164
    Likes Received:
    42
  2. eridonvevo77

    eridonvevo77 Regular Member

    Joined:
    Aug 27, 2015
    Messages:
    311
    Likes Received:
    47
    Gender:
    Male
    Location:
    Albania
    You can do it with Yoast Seo Wordpress.
     
  3. SebWgnr

    SebWgnr Registered Member

    Joined:
    Apr 19, 2016
    Messages:
    75
    Likes Received:
    57
    Home Page:
    I see that you use "X-Forwarded-Proto" so I'm guessing you use Cloudflare, if it's the case just create a page rule to force https.
    If you don't use Cloudflare you can use that:
    Code:
    RewriteEngine On
    RewriteCond%{HTTPS}!=on
    RewriteRule^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
     
  4. dannyvriens

    dannyvriens Registered Member

    Joined:
    Apr 3, 2010
    Messages:
    91
    Likes Received:
    32
    # First rewrite to HTTPS:
    RewriteCond %{HTTPS} off

    # No www in the RewriteRule this is already include in
    # the subsequent rule will catch it.
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Now, rewrite any request to the wrong domain to use www.
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]