redirecting http –> https AND non-www to www

[ad_1]

Hi I am wondering if this is the changes I should be making to my .htcaccess file

Note: I have no understanding of the formatting requirements.

\# BEGIN WordPress

\# The directives (lines) between “BEGIN WordPress” and “END WordPress” are

\# dynamically generated, and should only be modified via WordPress filters.

\# Any changes to the directives between these markers will be overwritten.

<IfModule mod\_rewrite.c>

RewriteEngine On

RewriteRule .\* – \[E=HTTP\_AUTHORIZATION:%{HTTP:Authorization}\]

RewriteBase /

RewriteRule \^index\\.php$ – \[L\]

RewriteCond %{REQUEST\_FILENAME} !-f

RewriteCond %{REQUEST\_FILENAME} !-d

RewriteCond %{HTTP\_HOST} \^[oxley.vic.edu.au]) \[NC\]RewriteCond %{HTTPS} off

RewriteRule \^(.\*)$ https://%{HTTP\_HOST}%{REQUEST\_URI} \[L,R=301\]

RewriteRule \^(.\*)$ [http://www.oxley.vic.edu.au/$1]) \[L,R=301,NC\]

RewriteRule . /index.php \[L\]

</IfModule>

&#x200B;

\# END WordPress

[ad_2]
1 Comment
  1. You don’t want to include your new stuff within the WordPress block as your changes can get overwritten when WP updates its permalinks. You also don’t need to include your domain name, as the htaccess variables take car of that.

    Add your new rules to the top of the file

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>

    # 301 REDIRECT NON-WWW TO WWW
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(?!www.)(.+) [NC]
    RewriteRule ^(.*) https://www.%1/$1 [R=301,NE,L]
    </IfModule>

    # BEGIN WORDPRESS….

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer