2016-11-07 122 views
0

我們的網站有問題,如果我寫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] 

謝謝!!

回答

0

你可以試試這個:

<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真實域。

+0

thanx爲快速回答,但現在它轉到https:// – user3647543

+0

對不起,我已經更新了答案。現在試試。 –

+0

謝謝Nerijus,它提供了太多的重定向,但我認爲這是主機問題,(一些隱藏的htaccess)。非常感謝您的幫助! – user3647543