2017-03-02 2 views
0

htaccessで次のコードを使用して、内部ページのURLをhttps://にリダイレクトしましたが、動作していません。私は私のホームページに行くと、それはhttpsにリダイレクトされ、すべての内側のページは同じですが、私は安全なURLを使用せずに内部のページにアクセスすると、セキュリティで保護されたリダイレクトされません。htaccess SSLへのリダイレクトが動作しない

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
RewriteCond %{HTTPS} !=on 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
</IfModule> 

# END WordPress 
<IfModule mod_expires.c> 
# Enable expirations 
ExpiresActive On 
# Default directive 
ExpiresDefault "access plus 1 month" 
# My favicon 
ExpiresByType image/x-icon "access plus 1 year" 
# Images 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
# CSS 
ExpiresByType text/css "access plus 1 month" 
# Javascript 
ExpiresByType application/javascript "access plus 1 year" 
</IfModule> 

誰でも助けてもらえますか?

答えて

0

あなたの書き換え条件は、すべての可能なwordpress URIに一致するにはあまりにも厳しいです。代わりにサーバポートに基づいてリダイレクトを試みるかもしれません。

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 
+0

こんにちは、高速応答ありがとうございますが、動作しませんでした。 index.php関連のコードを削除する必要があると思いますか?リダイレクトは機能しますが、URLは保護されていますが、内部ページに404エラーが表示されるためです。 –

+0

はい、サーバのポート条件をhtaccessファイルの先頭に移動したり、他のルールや条件を省略したりします。 – brirus

+0

ちょうどそれが働いた、ありがとう –

0

私はWP Force SSLプラグインを試してみることにします。私はこれを過去に使用して、.htaccessファイルを変更しないようにしました。

関連する問題