将.htaccess设置为转到https和php而不是html

将.htaccess设置为转到https和php而不是html,.htaccess,.htaccess,我有我的主机1和1,我刚刚得到一个SSL证书。我目前已将.htaccess更改为加载.php文件,而不是html文件,这可以很好地处理以下代码: RewriteEngine on #remove the need for .php extention RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php 现在,我希望站点加载https,不

我有我的主机1和1,我刚刚得到一个SSL证书。我目前已将.htaccess更改为加载.php文件,而不是html文件,这可以很好地处理以下代码:

RewriteEngine on

#remove the need for .php extention 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
现在,我希望站点加载https,不管它是否像
http://www
http://
等。我从不同的地方得到了很多不同的方法来实现这一点,因为如果我不指定
http://
http://www
。所以我想我会一次解决两个问题。代码1和1电源为:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.sitename\.co.uk$ [NC]
RewriteRule ^(.*)$ https://www.sitename.co.uk/$1 [R=301,L]
但这似乎本身并没有多大作用?我是否可以将这2个选项结合起来,简单地加载所有内容,并将所有链接更改为load.php。

这非常好用

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


RewriteEngine on
#remove the need for .php extention 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
这个很好用

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


RewriteEngine on
#remove the need for .php extention 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php