Your file looks very similar to the WordPress default, except for a couple items. First, you have multiple RewriteBase
directives. The last one wins and controls the entire .htaccess
file. This should be corrected. Second, you have a redirect from http
protocol to https
, which is probably fine and intentional.
According to the WordPress documentation, the default WordPress .htaccess
file contains:
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Working from the WordPress default file above, your file has some added lines that I'll explain.
Ths is a conditional test if the mod_rewrite module is enabled. It's fine, but may be optional in your case.
<IfModule mod_rewrite.c>
The first two lines below are fine. The second instance of RewriteEngine On
should be removed, and may be the source of your issue.
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteEngine On
These lines check for http
protocol and redirect to https
.
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This is the end of the conditional block. It's fine, and required because you have the line in number 1 above.
</IfModule>
Basically, your file looks correct to me, except for the second RewriteEngine On
directive. If you remove that and still have issues, I don't think you have an .htaccess
problem and should look for other issues in WordPress such as redirection plugins.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…