20i Reseller Hosting

htaccess help!

Discussion in 'Scripts and Coding' started by ian, Jan 31, 2019.

  1. ian

    ian Well-Known Member

    Joined:
    Jan 2008
    Posts:
    3,412
    Likes Received:
    223
    I've set the following htaccess redirects to cover off all instances of non-https, as well as any potential 404 errors, but I want all traffic to go to www. if the url is typed without. Can someone help!

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    ErrorDocument 404 https://MYURL
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
    articles.co.uk
     
  3. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    2,297
    Likes Received:
    307
    RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
     
    • Like Like x 1
  4. ian

    ian Well-Known Member

    Joined:
    Jan 2008
    Posts:
    3,412
    Likes Received:
    223
    Thanking you :)