.htaccess 什么';在htaccess文件中插入http/https重定向的最佳位置

.htaccess 什么';在htaccess文件中插入http/https重定向的最佳位置,.htaccess,redirect,https,.htaccess,Redirect,Https,我有一个很大的.htaccess文件需要编辑 此文件以以下方式启动: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 我应该在上的重写引擎下方添加这两行吗?我一直通过https提供

我有一个很大的
.htaccess
文件需要编辑

此文件以以下方式启动:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

我应该在
上的
重写引擎下方添加这两行吗?

我一直通过https提供的服务:

# All HTTPS to HTTP.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.yourdomainname.com%{REQUEST_URI} [L,R=301]

用您的域替换DomainName.com。

制作备份副本此类规则的最佳位置根本不在这样的动态配置文件中。将它们放在http服务器主机配置中。@arkascha:我对服务器(共享主机)几乎没有控制权。剩下两个选项:1。更改托管提供程序或2。将这些规则放在重写规则的顶部。@arkascha:我很乐意这么做,但我不是网站的所有者:-)好的,我的疑问是:“RewriteBase/”应该在后面吗?
# All HTTPS to HTTP.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.yourdomainname.com%{REQUEST_URI} [L,R=301]