2016-03-14 15 views
8

httpsを使用していますが、index.phpが削除されていませんが、httpで動作します。 httphttpsの両方で動作するなど、サイトの正常な動作が必要です。誰もが同じ問題に直面してこれを解決するのに役立ちます。index.php https CodeIgniterを削除しない

例:HTTPで

  1. http://xyz.mydomain.com/users/login //が細かい
  2. http://xyz.mydomain.com/index.php/users/login //がhttps

    1の微細

ワークス)https://xyz.mydomain.com/users/login// 404ページが見つかりません
2)https://xyz.mydomain.com/index.php/users/login //

$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST']; 
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); 
$config['base_url'] = $root; 
+0

コーディングハッピー;'インデックスを削除するには最初の場所に.phpを含める? –

+0

私が最初にすることは、 '$ config ['base_url']'がすべてのことをした後に何が設定されているかを確認することです。 'print_r($ config ['base_url'])のようなものです。 exit; ' –

+0

$ config ['index_page'] = '';あなたが書いたのと同じです –

答えて

1

があるようだと私のベースURLが設定されている細かい

MY htaccessのコード

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

config.phpの の作品あなたのホストファイルに問題があります。 Apacheを使用している場合は、ホストファイルを次のように変更します。

<VirtualHost *:443> 
    ServerAdmin [email protected] 
    DocumentRoot /path 
    ServerName xyz.mydomain.com 
    ServerAlias www.xyz.mydomain.com 

    SSLEngine On 
    SSLOptions +StrictRequire 
    SSLCertificateFile /path to ssl file/mydomain.crt 
    SSLCertificateKeyFile /path to ssl file/mydomain.key 
    SSLProtocol TLSv1 
    <Directory "/path"> 
     Require all granted 
     Options -FollowSymLinks -Includes -ExecCGI -Indexes 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
    RewriteEngine On 
</VirtualHost> 

今のようなあなたのhtaccessファイルをchnage:

<IfModule mod_rewrite.c> 
    Options +FollowSymLinks 
    RewriteEngine On 
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://xyz.mydomain.com/$1 [R=301,L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

`$の設定[ 'index_pageを'] = '' しない理由:)

+0

私のvhost設定の次の私のvhost設定でありがとう@sujeetクマールは不足していました** すべての許可が必要です オプション-FollowSymLinks -Includes -ExecCGI -Indexes AllowOverrideすべて オーダー可、拒否 すべて許可する RewriteEngine On **はうまく動作します。 –

関連する問題