2016-10-29 3 views
1

URLルーティングでcodeigniterを使用します。httpをCodeIgniterの複雑さでhttpsに移動するためのhtaccessコード

httpからhttpsに移行したいと考えています。

RewriteEngine On 
RewriteCond %{HTTP_HOST} !^eternalcitytours\.com$ [NC,OR] 
RewriteCond %{HTTP_HOST} ^XXX\.XXX\.XXX\.XXX [NC] 
RewriteRule ^(.*)$ http://eternalcitytours.com/$1 [R=301,L] 

<IfModule mod_rewrite.c> 
# Development 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond $1 !^(index\.php|images|scripts|styles|vendor|robots\.txt) 
    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

DirectoryIndex index.php 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] 

HTTP上の罰金以上の作品:

これが私の現在の.htaccessコードです。トラフィックを着信すると、HTTPから私に来るたび

  1. :私は2の問題を取得して、しかし

    RewriteEngine On 
        RewriteCond %{HTTPS} !=on 
        RewriteRule .* https://eternalcitytours.com/%{REQUEST_URI} [R,L] 
    
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} !^eternalcitytours\.com$ [NC,OR] 
    RewriteCond %{HTTP_HOST} ^037\.061\.237\.216 [NC] 
    RewriteRule ^(.*)$ https://eternalcitytours.com/$1 [R=301,L] 
    
    <IfModule mod_rewrite.c> 
    # Development 
        RewriteEngine On 
        RewriteBase/
        RewriteCond %{REQUEST_FILENAME} !-f 
        RewriteCond %{REQUEST_FILENAME} !-d 
        RewriteCond $1 !^(index\.php|images|scripts|styles|vendor|robots\.txt) 
        RewriteRule ^(.*)$ index.php/$1 [L] 
    </IfModule> 
    
    DirectoryIndex index.php 
    RewriteEngine on 
    RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] 
    

    上記のコードdoesntの仕事を:httpsに行くために

    は私がすること.htaccessを変更しましたリンクには、結果として得られるURLに余分なものがあります。例https://eternalcitytours.com//en/5/About-Eternal-City-Toursの代わりにhttps://eternalcitytours.com/en/5/About-Eternal-City-Tours

  2. 誰かがhttps://WWW.eternalcitytours.comを持っていれば、ページは読み込まれずにエラーが発生します。 (ERR_SSL_PROTOCOL_ERROR

私の正直なところ私がやっていることは分かっていないので、誰かが私の.htaccessコードを手伝ってくれますか?あなたはhttp -> httpsためにこのルールを使用する必要が

おかげ

答えて

1

%{REQUEST_URI}前に削除

RewriteCond %{HTTPS} !=on 
RewriteRule^https://eternalcitytours.com%{REQUEST_URI} [R=301,NE,L] 

注意/

ブラウザのキャッシュをクリアしてからテストしてください。

問題2の場合、SSL証明書はeternalcitytours.comドメイン専用です。 mod_rewriteルールが実行される前にSSLハンドシェイクが発生し、HTMLソースにhttpswwwのリンクを維持する点を除き、ルールベースの修正は存在しないためです。

+0

こんにちはanabhava、prob1が解決しました。どうも。 prob 2について言えば、SSL証明書がWWW https://WWW.eternalcitytoursを待っているという点で、人々がhttps://eternalcitytours.com /の下の自分のサイトに来ようとしたときにも、私は同じ問題を抱えていません。コム? –

+1

それは大丈夫です - 私はSSLハンドシェイクの前に起こるDNSレコードレベルでそれを持っています。私が持っていた追加の問題は、私がCloudFlareを使ってすべてを変更していて、今は無効にしていたということでした。どうも –

関連する問題