0

I am currently editing an existing site to enable https in it. The website has three requirements for redirect

urls with .html to .php
http to https
non-www to www

The code I am currently using is this

RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [L]
RewriteCond %{HTTP_HOST} ^websitename\.com$ [NC]
RewriteRule ^(.*)$ https://www.websitename.com/$1 [L,R=301]

But when I check www.websitename.com, it is not being redirected to https://www.websitename.com

I am trying many combinations for days (I have only basic knowledge of regexp), but it is showing one deficiency or another. Any help will be appreciated

0

1 Answer 1

1

To redirect to https you can use:

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.