How to redirect HTTP traffic to HTTPS using an .htaccess file

Home Forums Official Forum- Navsingh SSL Certificate (Https) How to ? Get all your answers on Https How to redirect HTTP traffic to HTTPS using an .htaccess file

This topic contains 1 reply, has 1 voice, and was last updated by  Nav Singh 2 years, 2 months ago.

  • Author
    Posts
  • #3204 Reply

    Nav Singh
    Keymaster

    How to redirect HTTP traffic to HTTPS using an .htaccess file

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    • This topic was modified 2 years, 2 months ago by  Nav Singh.
  • #3206 Reply

    Nav Singh
    Keymaster

    If you find RewriteEngine On in your .htaccess file dont write it again in that case just copy these 2 lines of code below: RewriteEngine On

    and you will be fine

    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Reply To: How to redirect HTTP traffic to HTTPS using an .htaccess file
Your information:




Official Forum

This is the Official Forum of Navsingh a community that helps you find answers to all of your problems,they can be Java/programming,wordpress,android, android programming, seo related or technology related