Frage

Ich entwickle eine Website mit dem PHP Yii Framework und bin jetzt im Stack. Ich muss gii starten, aber ich kann das nicht tun.Wenn ich www.example.com/index.php/gii oder www.example.com/gii eingebe, erhalte ich folgende Fehlermeldung:

    /gii/default/login // <- website redirects to here

    This webpage has a redirect loop
    The webpage at http://www.example.com/gii/default/login has resulted in too many redirects.
Clearing your cookies for this site or allowing third-party cookies may fix the problem. 
If not, it is possibly a server configuration issue and not a problem with your computer.

Ich glaube nicht, dass der Fehler an der geänderten htaccess- und Hauptkonfiguration liegt, aber hier ist trotzdem die Konfigurationsdatei main.php:

    'urlManager'=>array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
        'rules'=>array(
            'site/page/<view:\w+>'=>'site/page',
            '<controller:\w+>/<cact:\w+>/<action:\w+>'=>'<controller>/<cact>',
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    ),

und .htaccess:

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

#non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# 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 [L]

Können Sie mir bitte helfen?

War es hilfreich?

Lösung

Prüfen Sie, ob das GII-Modul in Ihrer Konfigurationsdatei vorhanden ist und nicht vollständig ist. Wenn GII nicht da ist, sollten Sie ihn innerhalb des Modularrays hinzufügen.

generasacodicetagpre.

mehr Info für GII hier

Andere Tipps

Um diesen Pfad zu verwenden: index.php?r=gii/default/login , müssen Sie den URL-Manager ausschalten /protected/config/main.php

Überprüfen Sie auch urlManager'S rules.Das war bei mir das Problem:

'components' => array(
    'urlManager' => array(
        'urlFormat' => 'path',
        'showScriptName' => false,
        'rules' => array(
            // ...
            // will handle `gii/default/login` uri and makes infinite redirection loop circle
            '<controller:\w+>/<action:\w+>/<sub_action:\w+>'=>'<controller>/<action>',
            // ...
        ),
     ),
 ),

Wie FelikZ erwähnt, könnte dies daran liegen, dass Sie einen dritten Parameter in einer Regel erstellt haben, die verwendet \w+ anstelle der Standardeinstellung \d+ und entspricht daher „gii“ als Controller, „default“ als Aktion und „login“ als ID (oder Unteraktion oder was auch immer erwähnt wird).

Meine Regeln sahen so aus:

'<controller:\w+>/<action:\w+>/<id:\w+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

Die Lösung besteht darin, als allererste Regel Folgendes hinzuzufügen, damit gii an der richtigen Stelle landet:

'gii/<controller:\w+>/<action:[\w-]+>' => 'gii/<controller>/<action>',

Das sollte Ihr Ganzes ausmachen urlManager config sieht etwa so aus:

'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName'=>false,
    'rules'=>array(
        'gii/<controller:\w+>/<action:[\w-]+>' => 'gii/<controller>/<action>',

        '<controller:\w+>/<action:\w+>/<id:\w+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
    ),
),

Dieses Problem tritt aufgrund der beiden Sitzungen des OPs auf, z. B. Cookie PHPSSID dort zwei Domänenbereich .Site.ru und admin.site.ru zwei verschiedene Sitzungen.Löschen Sie PHPSSSSID-Cookies und loggen Sie sich bei GII

an.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top