codehaven - php snippets - coding help
Generic filters
Exact matches only

Redirect to www and https (.htaccess) wordpress

26th July 2019



When you have added an SSL certificate to your domain, you can force all users that visit your site to use HTTPS to ensure your website is secure.

Q. Where should the .htaccess file be created?
A. The .htaccess file should be located in your website’s root directory.

Save as .htaccess and upload to root.
This code was last checked working on February 2020.
The code below will make your .htaccess redirect to www also.

Note: Change the domain name.

Was this code snippet helpful?