WordPress – Redirect All HTTP requests to HTTPS via .htaccess

Home Forums WordPress WordPress – Redirect All HTTP requests to HTTPS via .htaccess

This topic contains 0 replies, has 1 voice, and was last updated by  KeyMaster 8 months, 2 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #12537

    KeyMaster
    Keymaster

    To force redirect all HTTP requests to HTTPS on your WordPress driven website what you need to do is insert the code below in the .htaccess

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # Rewrite HTTP to HTTPS
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
    </IfModule>
    # END WordPress
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.