2016-11-20 8 views
0

.htaccess内容はとして怒鳴るです:Yiiフレームワークindex.phpを隠す方法は?

RewriteEngine on 

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# otherwise forward it to index.php 
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA] 

とURL Managerは、次のとおりです。

'urlManager' => array(
     'urlFormat' => 'path', 
     'showScriptName' => false, 
     'urlSuffix' => '.jsp', 
     'caseSensitive' => false, 

が、私は、ホームページ以外のすべてのサブページとのリンクにアクセスすると、それindex.phpをせずに動作していません。 これを解決するには?

答えて

0
Set main.php in your yii configuration, at component : 

'urlManager'=>array(
'urlFormat'=>'path', 
'showScriptName'=>false, 
'caseSensitive'=>false,   

)、

これはあなたがメインの設定ファイルにurlManager配列にスクリプトの下に追加することができます動作していない場合。

例えば、 -

'routeVar'=>'route' 
+0

以下と保護/設定/ main.php [URLマネージャブロック]を変更してください、私は削除する必要があることを意味'urlSuffix'? – jones

0

コードの下

Options +FollowSymLinks 
IndexIgnore */* 
RewriteEngine on 

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# otherwise forward it to index.php 
RewriteRule . index.php 
#RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA] 

であなたのhtaccessファイルを変更し、コード

'urlManager' => array(
    'urlFormat' => 'path', 
     'showScriptName'=>false, 
     'rules' => array(
      '<controller:\w+>/<id:\d+>' => '<controller>/view', 
      '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', 
      '<controller:\w+>/<action:\w+>' => '<controller>/<action>', 
     ), 
    ), 
関連する問題