apache htaccess不会将https:// www添加到除inside.php之外的任何页面

We have a client's site that is currently on our development server. We are having some issues formatting the .htaccess file. Currently, the htaccess file is causing a redirect to https://www. only on inside.php. Our goal is to make every page redirect to use https://www.. We are currently using a base url set-up in our header.php file that is included on every page. Unsure if there is a better way to accomplish what we are trying to do, but if there is any help would be appreciated.

Here is the current contents of our .htaccess file.

RewriteEngine on

#enables you to access PHP files with HTML extension
AddType application/x-httpd-ea-php70 .html .htm

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]

#forces https://
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#forces www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


RewriteRule ^physicians(/((([a-zA-Z0-9_-]+)/?)*))?$    physicians.php?link=$2    [NC,L]

RewriteRule ^((([a-zA-Z0-9_-]+)/?)*)$ inside.php?page=$1


ErrorDocument 404 /inside.php

You exit early, when the request is for a real file, directory or symbolic link

RewriteRule ^ - [L]

Only after this rule, requests are redirected to https://www.. To redirect all requests to https://www., move the rules to the beginning, e.g.

#forces www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R]

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

# all other rules come here
# ...

I also moved the non-www part to the front, because otherwise you have two redirects, if the original request is for http://example.com.

Never test with R=301!