wordpress htaccess重写规则https到http
问题描述:
我们的网站有问题,如果我写https://example.com它会转到另一个网站,因为我们与其他网域的IP位于同一IP。我如何将其重定向到我的http://域? 这里是我的htacess:wordpress htaccess重写规则https到http
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{ENV:HTTPS} =on
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteCond %{HTTPS} ^on$
RewriteRule ^(.*)$ http://example.com/$1 [NC,L,R]
谢谢!!
答
你可以试试这个:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
# Force https
RewriteCond %{REMOTE_ADDR} !^127.0.0.1$ [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} =https [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
重要:不要忘记改变yourdomain.com真实域。
thanx为快速回答,但现在它转到https:// – user3647543
对不起,我已经更新了答案。现在试试。 –
谢谢Nerijus,它提供了太多的重定向,但我认为这是主机问题,(一些隐藏的htaccess)。非常感谢您的帮助! – user3647543