MR 100% scheint nicht zu klappen

Gesperrt
JochBec
Beiträge: 54
Registriert: Sa 18. Dez 2004, 15:11
Kontaktdaten:

MR 100% scheint nicht zu klappen

Beitrag von JochBec » Sa 12. Feb 2011, 10:28

Hallo ;)

Ich habe in den Einstellungen im Advanced Mod Rewrite bei

Prozentsatz für "ähnlich klingende" URIs

100% eingestellt. Trotzdem werden ähnliche Links genommen. Laut Definition bedeutet 100% = nur exakt geschriebene URIs finden zum Ziel, bereits ein falsch geschriebener Buchstabe führt zu einem Fehler.

Bei mir tut es das nicht. Beispiel:

http://www.trailerseite.de/archiv/trail ... ailer.html

ist die korrekte URL. Wen man aber http://www.trailerseite.de/archiv/trail ... dfhsvsdfvh[/b]-2011/16988-the-rite-film-trailer.html eingibt, funktioniert es auch.

Jemand eine Idee wieso? Ich hatte schon den Verdacht, daß die Konfig für das MR einfach nicht greift und irgendwas beim rumfrickeln die Einstellungen hier hardgecodet hat. Alle anderen Änderungen für das MR nimmt Contenido aber anscheinend an.

Danke für eure Hilfe!

Jochen

xmurrix
Beiträge: 3147
Registriert: Do 21. Okt 2004, 11:08
Wohnort: Augsburg
Kontaktdaten:

Re: MR 100% scheint nicht zu klappen

Beitrag von xmurrix » Sa 12. Feb 2011, 12:55

Hallo JochBec,

es ist im Backend nicht deutlich erklärt, die Angabe 'Prozentsatz für "ähnlich klingende" URLs' in der Pluginkonfiguration bezieht sich nur auf den Pfadanteil in der URL.
Das heißt, es funktioniert nur dann, wenn die URLs nur Kategoriealiase enthalten, also keine Artikelaliase.

In deinem Beispiel führen beide Pfade in der URL

Code: Alles auswählen

/archiv/trailer-2011/
/archiv/trailerksdvjhsvkjdfhsvsdfvh-2011/
zur gleichen Seite. Das liegt daran, dass das Plugin, wenn die Kategorie nicht ermittelt werden konnte, dennoch versucht, die Artikelid anhand von (16988-the-rite-film-trailer.html) zu finden.

Lange Rede kurzer Sinn, das Verhalten des Plugins ist hiernei nicht ideal und gehört überarbeitet.

Versuch doch mit der Einstellung "Duplicated Content" zu Arbeiten, die Vergleicht nämlich die komplette URL und lässt keine alternativen URLs Kategorien/Artikel zu. Hier musst du aber noch eine Kleinigkeit anpassen, öffne die Datei "contenido/plugins/mod_rewrite/classes/class.modrewritecontroller.php" und ändere die Zeile 522 von

Code: Alles auswählen

        if (parent::getConfig('startfromroot') == 1 && parent::getConfig('prevent_duplicated_content') == 1 && !isset($_GET['noex'])) {
in

Code: Alles auswählen

        if (parent::getConfig('prevent_duplicated_content') == 1 && !isset($_GET['noex'])) {
Eine aktivierte "Duplicated Content" Überprüfung lässt sich dennoch abschalten, wenn in der URL der Parameter "noex" vorkommt, z. B. "front_content.php?idart=123&noex=1". Das ist z. B. beim Newsletter-Plugin der Fall, da dieser die Newsletterartikel nach dem Schema "front_content.php?idart=123&noex=1", dann soll die Newsletterseite trotz aktiviertem AMR-Plugin und der Einstellung "Duplicated Content" dennoch ausgegeben werden.

Ich merke es schon, es ist an der Zeit für ein neues Release des AMR-Plugins...

Gruß
xmurrix
CONTENIDO Downloads: CONTENIDO 4.10.1
CONTENIDO Links: Dokumentationsportal, FAQ, API-Dokumentation
CONTENIDO @ Github: CONTENIDO 4.10 - Mit einem Entwicklungszweig (develop-branch), das viele Verbesserungen/Optimierungen erhalten hat und auf Stabilität und Kompatibilität mit PHP 8.0 bis 8.2 getrimmt wurde.

JochBec
Beiträge: 54
Registriert: Sa 18. Dez 2004, 15:11
Kontaktdaten:

Re: MR 100% scheint nicht zu klappen

Beitrag von JochBec » Mo 14. Feb 2011, 08:17

Hi xmurrix,

danke für die schnelle Hilfe.

Mit der DC Option ist es zwar deutlich besser, aber immer noch nicht richtig...

Die besagte Zeile die ich ändern sollte, gibt es bei mir übrigens nicht, es mag daran liegen ;)

Ich verwende 4.8.12 und die entsprechende Stelle heisst

Code: Alles auswählen

        if ($this->_aCfgMR['startfromroot'] == 1 && $this->_aCfgMR['prevent_duplicated_content'] == 1 && count($this->_aParts) > 0) {
und ist in Zeile 565.

Wenn ich die also unverändert lasse und die DC-Option aktiviere, dann kommt die Fehlerseite immer bei einem Zeichen Unterschied brav nach dem letzten "/", also im Alias. Bei den Verzeichnissen kann ich aber weiter munter endlose Zeichenketten reinballern und die Seite wird trotzdem gefunden. Das löst das Problem also auch noch nicht wirklich...

Hast du zufälligerweise noch eine Idee? ;)

Danke und Gruß,

Jochen

xmurrix
Beiträge: 3147
Registriert: Do 21. Okt 2004, 11:08
Wohnort: Augsburg
Kontaktdaten:

Re: MR 100% scheint nicht zu klappen

Beitrag von xmurrix » Di 15. Feb 2011, 21:56

Hallo JochBec,

je nach AMR-Version kann die Zeile sich woanders befinden, welche Version des Plugins hast du denn?

Mit der Änderung der einen Zeile in der entsprechenden Datei sollte es egentlich funktioneren. Du kannst aber auch die angepasste Version der class.modrewritecontroller.php aus dem Beitrag http://forum.contenido.org/viewtopic.php?f=66&t=30419 verwenden. Die Änderung wurde eigentlich wegen auftretender Probleme mit dem Newsletterversand gemacht, sollte sich aber auch wie gewünscht auf die aktivierte Einstellung "Duplicated content" auswirken.

Bei mir hat das unter Contenido 4.8.14 (gilt auch für Versionen größer 4.8.10) ohne Probleme funktioniert.

Gruß
xmurrix
CONTENIDO Downloads: CONTENIDO 4.10.1
CONTENIDO Links: Dokumentationsportal, FAQ, API-Dokumentation
CONTENIDO @ Github: CONTENIDO 4.10 - Mit einem Entwicklungszweig (develop-branch), das viele Verbesserungen/Optimierungen erhalten hat und auf Stabilität und Kompatibilität mit PHP 8.0 bis 8.2 getrimmt wurde.

JochBec
Beiträge: 54
Registriert: Sa 18. Dez 2004, 15:11
Kontaktdaten:

Re: MR 100% scheint nicht zu klappen

Beitrag von JochBec » Mi 16. Feb 2011, 08:31

Moin,

danke für den Tipp. Wenn ich allerdings die Version aus dem genannten Thread bei mir hochlade, dann bekomme ich global diese Fehlermeldung:

Fatal error: Class 'ModRewriteBase' not found in class.modrewritecontroller.php on line 29

Und was ich da ändern sollte, weiß ich nicht, denn eine Base kann ich in dieser Datei nicht finden. Also müßte es wieder woanders festgelegt sein und da greift dann mein gefährliches Halbwissen ;) Da ändere ich lieber nichts auf Verdacht.

Aktuell verwende ich die MR Version vom 16.04.2008. Ich kopier sie mal ganz rein, damit du nicht danach suchen musst:

Code: Alles auswählen

<?php
/**
 * Includes Mod Rewrite controller class.
 *
 * @author      Murat Purc <murat@purc.de>
 * @copyright   © Murat Purc 2008
 * @package     Contenido
 * @subpackage  ModRewrite
 */


if(!defined('CON_FRAMEWORK')) {
    die('Illegal call');
}


/**
 * Mod Rewrite controller class. Extracts url parts and sets some necessary globals like:
 * - $idart
 * - $idcat
 * - $client
 * - $changeclient
 * - $lang
 * - $changelang
 *
 * TODO: Adapt to PHP 5 coding standards...
 *
 * @author      Murat Purc <murat@purc.de>
 * @date        16.04.2008
 * @package     Contenido
 * @subpackage  ModRewrite
 */
class ModRewriteController {

    /**
     * Contenido configuration array (see $GLOBALS['cfg'])
     *
     * @var array
     */
    var $_aCfg;

    /**
     * Mod Rewrite configuration array (see $GLOBALS['cfg']['mod_rewrite'])
     *
     * @var array
     */
    var $_aCfgMR;

    /**
     * Extracted request uri path parts by path separator '/'
     *
     * @var array
     */
    var $_aParts;

    /**
     * Extracted article name from request uri
     *
     * @var string
     */
    var $_sArtName;

    /**
     * Remaining path for path resolver (see $GLOBALS['path'])
     *
     * @var string
     */
    var $_sPath;

    /**
     * Incomming URL
     *
     * @var string
     */
    var $_sIncommingUrl;

    /**
     * Resolved URL
     *
     * @var string
     */
    var $_sResolvedUrl;

    /**
     * Client id used by this class
     *
     * @var int
     */
    var $_iClientMR;

    /**
     * Flag about occured errors
     *
     * @var bool
     */
    var $_bError = false;

    /**
     * Flag about found routing definition
     *
     * @var bool
     */
    var $_bRoutingFound = false;

    /**
     * Constructor, sets several properties.
     *
     * @param  string  $incommingUrl  Incomming URL
     */
    function ModRewriteController($incommingUrl) {
        $this->_sIncommingUrl = $incommingUrl;
        $this->_aCfg          = & $GLOBALS['cfg'];
        $this->_aCfgMR        = & $GLOBALS['cfg']['mod_rewrite'];
        $this->_aParts        = array();
    }


    /**
     * Getter for overwritten client id (see $GLOBALS['client'])
     *
     * @return  int  Client id
     */
    function getClient() {
        return $GLOBALS['client'];
    }


    /**
     * Getter for overwritten change client id (see $GLOBALS['changeclient'])
     *
     * @return  int  Change client id
     */
    function getChangeClient() {
        return $GLOBALS['changeclient'];
    }


    /**
     * Getter for article id (see $GLOBALS['idart'])
     *
     * @return  int  Article id
     */
    function getIdArt() {
        return $GLOBALS['idart'];
    }


    /**
     * Getter for category id (see $GLOBALS['idcat'])
     *
     * @return  int  Category id
     */
    function getIdCat() {
        return $GLOBALS['idcat'];
    }


    /**
     * Getter for language id (see $GLOBALS['lang'])
     *
     * @return  int  Language id
     */
    function getLang() {
        return $GLOBALS['lang'];
    }


    /**
     * Getter for change language id (see $GLOBALS['change_lang'])
     *
     * @return  int  Change language id
     */
    function getChangeLang() {
        return $GLOBALS['changelang'];
    }


    /**
     * Getter for path (see $GLOBALS['path'])
     *
     * @return  string  Path, used by path resolver
     */
    function getPath() {
        return $this->_sPath;
    }


    /**
     * Getter for resolved url
     *
     * @return  string  Resolved url
     */
    function getResolvedUrl() {
        return $this->_sResolvedUrl;
    }


    /**
     * Returns a flag about found routing definition
     *
     * return  bool  Flag about found routing
     */
    function getRoutingFoundState() {
        return $this->_bRoutingFound;
    }


    /**
     * Getter for occured error state
     *
     * @return  bool  Flag for occured error
     */
    function errorOccured(){
        return $this->_bError;
    }


    /**
     * Main function to call for mod rewrite related preprocessing jobs.
     *
     * Executes some private functions to extract request URI and to set needed membervariables
     * (client, language, article id, category id, etc.)
     */
    function execute() {

        if (ModRewrite::is_enabled() == false) {
            return;
        }

        $this->_extractRequestUri();

        $this->_overrideConfig();

        $this->_preprocessVariables();

        $this->_setClientId();
#        $GLOBALS['mpDebug']->addDebug($GLOBALS['client'], 'ModRewriteController::execute() $GLOBALS[\'client\']');

        mr_loadConfiguration($this->_iClientMR);

        $this->_setLanguageId();
#        $GLOBALS['mpDebug']->addDebug($GLOBALS['lang'], 'ModRewriteController::execute() $GLOBALS[\'lang\']');

        // second call after setting client and language
        $this->_extractRequestUri(true);

        $this->_setPathresolverSetting();
#        $GLOBALS['mpDebug']->addDebug($this->_aParts, 'ModRewriteController::execute() after _setPathresolverSetting');

        $this->_setIdart();
        $GLOBALS['mpDebug']->addDebug($this->_aParts, 'ModRewriteController::execute() _setIdart');

        $this->_postValidation();
    }


    /**
     * Extracts request URI and sets member variables $this->_sArtName and $this->_aParts
     *
     * @access  private
     */
    function _extractRequestUri($secondCall=false) {

        // check for defined rootdir
        if ($this->_aCfgMR['rootdir'] !== '/' && strpos($_SERVER['REQUEST_URI'], $this->_sIncommingUrl) === 0) {
            $this->_sIncommingUrl = str_replace($this->_aCfgMR['rootdir'], '/', $this->_sIncommingUrl);
        }
#		$GLOBALS['mpDebug']->addDebug($this->_sIncommingUrl, 'ModRewriteController::_extractRequestUri() this->_sIncommingUrl');

        $aUrlComponents = $this->parseUrl($this->_sIncommingUrl);

        if (isset($aUrlComponents['path'])) {

            if ($secondCall == true) {

                // TODO: damn routing code...

                // check for routing definition
                if (is_array($this->_aCfgMR['routing']) && isset($this->_aCfgMR['routing'][$aUrlComponents['path']])) {
                    $aUrlComponents['path'] = $this->_aCfgMR['routing'][$aUrlComponents['path']];
                    if (strpos($aUrlComponents['path'], 'front_content.php') !== false) {
                        // routing destination contains front_content.php

                        $this->_bRoutingFound = true;

                        // set client language, if not set before
                        mr_set_client_language($GLOBALS['client']);

                        //rebuild URL
                        $url = mr_build_new_url($aUrlComponents['path']);

                        $aUrlComponents = $this->parseUrl($url);

                        $this->_aParts = array();
                    }
                } else {
                    return;
                }
            }

            $aPaths = explode('/', $aUrlComponents['path']);
            foreach ($aPaths as $p => $item) {
                if (!empty($item)) {
                    // pathinfo would also work
                    $arr = explode('.', $item);
                    if (count($arr) > 0 && '.'.strtolower($arr[count($arr)-1]) == $this->_aCfgMR['file_extension']) {
                        array_pop($arr);
                        $this->_sArtName = implode('.', $arr);
                    } else {
                        $this->_aParts[] = $item;
                    }
                }
            }

            if ($secondCall == true) {
                // reprocess extracting client and language
                $this->_setClientId();
                mr_loadConfiguration($this->_iClientMR);
                $this->_setLanguageId();
            }

        }
        $GLOBALS['mpDebug']->addDebug($this->_aParts, 'ModRewriteController::_extractRequestUri() $this->_aParts');

        // loop parts array and remove existing 'front_content.php'
        if ($this->_hasPartArrayItems()) {
            foreach($this->_aParts as $p => $item) {
                if ($item == 'front_content.php') {
                    unset($this->_aParts[$p]);
                }
            }
        }
#		$GLOBALS['mpDebug']->addDebug($this->_aParts, 'ModRewriteController::_extractRequestUri() $this->_aParts 2.');

        // set parts property top null, if needed
        if ($this->_hasPartArrayItems() == false) {
            $this->_aParts = null;
        }
#		$GLOBALS['mpDebug']->addDebug($this->_aParts, 'ModRewriteController::_extractRequestUri() $this->_aParts 3.');

        // set artname to null if needed
        if (!isset($this->_sArtName) || empty($this->_sArtName) || strlen($this->_sArtName) == 0) {
            $this->_sArtName = null;
        }
#		$GLOBALS['mpDebug']->addDebug($this->_sArtName, 'ModRewriteController::_extractRequestUri() $this->_sArtName');

    }


    /**
     * Overrides local mod rewrite cfg settings with client settings from database
     *
     * @access  private
     */
    function _overrideConfig() {

        if ((int) substr($this->_aCfg['version'],0,1) . substr($this->_aCfg['version'],2,1) >= 46) {
            $this->_iClientMR = 0;
            if (isset($GLOBALS['client']) && !empty($GLOBALS['client']) && !isset($GLOBALS['changeclient'])) {
                $this->_iClientMR = $GLOBALS['client'];
            } elseif (isset($GLOBALS['changeclient']) && !empty($GLOBALS['changeclient'])) {
                $this->_iClientMR = $GLOBALS['changeclient'];
            } else {
                $this->_iClientMR = $GLOBALS['load_client'];
            }

            if ((int) $this->_iClientMR !== 0) {
                // set global $GLOBALS['client'] variable
                $GLOBALS['client'] = (int) $this->_iClientMR;
            }
        }
    }


    /**
     * Preprocesses article name and parts list, sets article name and parts list
     * if settings for usage of categories as a html file is active and valid.
     *
     * @deprecated
     *
     * @access  private
     */
    function _preprocessVariables() {
return;
        // check for html file only links and prepare variables
        if ($this->_sArtName && ModRewrite::validate_setting_categories_as_html()) {
            $aParts = explode($this->_aCfgMR['article_seperator'], $this->_sArtName);
            if (count($aParts) > 0) {
                $this->_aParts   = (isset($aParts[0]) && strlen($aParts[0]) > 0) ? explode($this->_aCfgMR['category_seperator'], $aParts[0]) : false;
                $this->_sArtName = (isset($aParts[1]) && strlen($aParts[1]) > 0) ? $aParts[1] : false;
#$GLOBALS['mpDebug']->vdump($this->_aParts, '_preprocessVariables $this->_aParts');
#$GLOBALS['mpDebug']->vdump($this->_sArtName, '_preprocessVariables $this->_sArtName');
            }
        }
    }


    /**
     * Sets client id
     *
     * @access  private
     */
    function _setClientId() {
        if ($this->_hasPartArrayItems() == false || $this->_aCfgMR['use_client'] !== 1) {
            return;
        }

        if ($this->_aCfgMR['use_client_name'] == 1) {
            $GLOBALS['changeclient'] = mr_get_client_id(array_shift($this->_aParts));
            $this->_iClientMR        = $GLOBALS['changeclient'];
        } else {
            $GLOBALS['changeclient'] = (int) array_shift($this->_aParts);
            $this->_iClientMR        = $GLOBALS['changeclient'];
        }

        if (empty($GLOBALS['changeclient']) || (int) $GLOBALS['changeclient'] == 0) {
            $GLOBALS['changeclient'] = $GLOBALS['load_client'];
        }
        if (isset($GLOBALS['client']) && $GLOBALS['changeclient'] !== $GLOBALS['client']) {
            // overwrite existing global $GLOBALS['client'] variable
            $GLOBALS['client'] = $GLOBALS['changeclient'];
            $this->_iClientMR        = $GLOBALS['changeclient'];
        }


#		$GLOBALS['mpDebug']->addDebug($GLOBALS['changeclient'], 'ModRewriteController::_setClientId() $GLOBALS[\'changeclient\']');
#		$GLOBALS['mpDebug']->addDebug($this->_iClientMR, 'ModRewriteController::_setClientId() $this->_iClientMR');
    }


    /**
     * Sets language id
     *
     * @access  private
     */
    function _setLanguageId() {
        if ($this->_hasPartArrayItems() == false || $this->_aCfgMR['use_language'] !== 1) {
            return;
        }

        if ($this->_aCfgMR['use_language_name'] == 1) {
            // thanks to Nicolas Dickinson for multi Client/Language BugFix
            $GLOBALS['changelang'] = mr_get_language_id(array_shift($this->_aParts) , $this->_iClientMR);
        } else {
            $GLOBALS['changelang'] = (int) array_shift($this->_aParts);
        }
#		$GLOBALS['mpDebug']->addDebug($GLOBALS['changelang'], 'ModRewriteController::_setLanguageId() $GLOBALS[\'changelang\']');

        if (empty($GLOBALS['changelang']) || (int) $GLOBALS['changelang'] == 0) {
            unset($GLOBALS['changelang']);
        } else {
            $GLOBALS['lang'] = $GLOBALS['changelang'];
        }
    }


    /**
     * Sets path resolver and category id
     *
     * @access  private
     */
    function _setPathresolverSetting() {
        if ($this->_hasPartArrayItems() == false) {
            return;
        }

        $this->_sPath = '/' .implode('/', $this->_aParts) . '/';

        // TODO: time to get catid is to long, should be cached!!!
        if (!isset($GLOBALS['lang'])) {
            if (!isset($GLOBALS['load_lang'])) {
                // load_client is set in frontend/config.php
                $GLOBALS['lang'] = $GLOBALS['load_lang'];
            } else {
                // get client id from table
                cInclude('classes', 'contenido/class.clientslang.php');
                $clCol = new cApiClientLanguageCollection();
                $clCol->setWhere('idclient', $GLOBALS['client']);
                $clCol->query();
                if ($clItem = $clCol->next()) {
                    $GLOBALS['lang'] = $clItem->get('idlang');
                }
            }
        }


        $GLOBALS['idcat'] = prResolvePathViaURLNames($this->_sPath);
#        $GLOBALS['idcat'] = mr_prResolvePathViaURLNames($this->_sPath);

        if (!$GLOBALS['idcat'] || (int) $GLOBALS['idcat'] == 0) {
            // set this flag, it's used in front_content.php
            $this->_bError = true;
            unset($GLOBALS['idcat']);
        } else {
            // unset $this->_sPath if $GLOBALS['idcat'] could set, otherwhise it would be resolved again.
            unset($this->_sPath);
        }

        $GLOBALS['mpDebug']->addDebug($GLOBALS['idcat'], 'ModRewriteController->_setPathresolverSetting $GLOBALS[\'idcat\']');
        $GLOBALS['mpDebug']->addDebug($this->_sPath, 'ModRewriteController->_setPathresolverSetting $this->_sPath');
    }


    /**
     * Sets article id
     *
     * @access  private
     */
    function _setIdart() {

        // startarticle name in url
        if ($this->_aCfgMR['add_startart_name_to_url'] && isset($this->_sArtName)) {
            if ($this->_sArtName == $this->_aCfgMR['default_startart_name']) {
                // stored articlename is the default one, remove it mr_get_idart()
                // will find the real article name
                $this->_sArtName = null;
            }
        }

        if (isset($GLOBALS['idcat']) && $this->_sArtName && !isset($GLOBALS['idart'])) {
            // existing idcat with article name and no idart
            $GLOBALS['idart'] = mr_get_idart($this->_sArtName, $GLOBALS['idcat']);
        } elseif ($GLOBALS['idcat'] > 0 && $this->_sArtName == null && !isset($GLOBALS['idart'])) {

#            if (!$this->_aCfgMR['add_startart_name_to_url'] ||
#                ($this->_aCfgMR['add_startart_name_to_url'] && $this->_aCfgMR['default_startart_name'] == '')) {
            if ($this->_aCfgMR['add_startart_name_to_url'] && $this->_aCfgMR['default_startart_name'] == '') {

                // existing idcat without article name and idart
                cInclude('classes', 'class.article.php');
                $artColl = new ArticleCollection(array('idcat' => $GLOBALS['idcat'], 'start' => 1));
                if ($artItem = $artColl->startArticle()) {
                    $GLOBALS['idart'] = $artItem->get('idart');
                }

            }

        } elseif (!isset($GLOBALS['idcat']) && isset($this->_sArtName) && !isset($GLOBALS['idart'])) {
            // no idcat and idart but article name
            $GLOBALS['idart'] = mr_get_idart($this->_sArtName);
        }

        if (isset($GLOBALS['idart']) && (!$GLOBALS['idart'] || (int) $GLOBALS['idart'] == 0)) {
            if ($this->_aCfgMR['redirect_invalid_article_to_errorsite'] == 1) {
                $this->_bError = true;
                unset($GLOBALS['idart']);
            }
        }

        $GLOBALS['mpDebug']->addDebug($GLOBALS['idart'], 'ModRewriteController->_setIdart $GLOBALS[\'idart\']');
    }


    /**
     * Does post validation of the extracted data.
     *
     * One main goal of this function is to prevent duplicated content, which could happen, if
     * the configuration 'startfromroot' is activated.
     */
    function _postValidation() {
        if ($this->_bError || $this->_bRoutingFound) {
            return;
        }

        if ($this->_aCfgMR['startfromroot'] == 1 && $this->_aCfgMR['prevent_duplicated_content'] == 1 && count($this->_aParts) > 0) {

            // prevention of duplicated content if '/firstcat/' is directly requested!

            // compose new parameter
            $param = '';
            if ($this->getIdCat()) {
                $param .= 'idcat=' . (int) $this->getIdCat();
            }
            if ($this->getIdArt()) {
                $param .= ($param !== '') ? '&idart=' . (int) $this->getIdArt() : 'idart=' . (int) $this->getIdArt();
            }

            if ($param == '') {
                return;
            }

            // set client language, if not set before
            mr_set_client_language($GLOBALS['client']);

            //rebuild url
            $url = mr_build_new_url('front_content.php?' . $param);

            $aUrlComponents = @parse_url($this->_sIncommingUrl);
            $incommingUrl   = (isset($aUrlComponents['path'])) ? $aUrlComponents['path'] : '';

            $GLOBALS['mpDebug']->addDebug($url, 'ModRewriteController->_postValidation validate uri');
            $GLOBALS['mpDebug']->addDebug($incommingUrl, 'ModRewriteController->_postValidation incommingUri');

            // now the new generated uri should be identical with the request uri
            if ($incommingUrl !== $url) {
                $this->_bError = true;
                unset($GLOBALS['idcat']);
            }
        }
    }


    function parseUrl($url) {
        $this->_sResolvedUrl = $url;

        if (ModRewrite::validate_setting_categories_as_html()) {
            $ext = $this->_aCfgMR['file_extension'];
            $url = str_replace($ext, '{EXT}', $url);

            // replace category seperator against /
            $url = str_replace($this->_aCfgMR['category_seperator'], '/', $url);

            // replace article seperator against /
            $url = str_replace($this->_aCfgMR['article_seperator'], '/', $url);

            $url = str_replace('{EXT}', $ext, $url);

        }

#        $this->_sResolvedUrl = $url;
#        $GLOBALS['mpDebug']->addDebug($url, 'ModRewriteController->parseUrl $url');

        return @parse_url($url);
    }


    /**
     * Returns state of parts property
     *
     * @return  bool  True if $this->_aParts propery is an array and contains items
     * @access  private
     */
    function _hasPartArrayItems() {
        if (is_array($this->_aParts) && count($this->_aParts) > 0) {
            return true;
        } else {
            return false;
        }
    }

}
Hier gab es, wie gesagt, nur die eine Stelle in Zeile 565 die auf deine Beschreibung passte.

Danke nochmal!!

Jochen

xmurrix
Beiträge: 3147
Registriert: Do 21. Okt 2004, 11:08
Wohnort: Augsburg
Kontaktdaten:

Re: MR 100% scheint nicht zu klappen

Beitrag von xmurrix » Do 17. Feb 2011, 22:03

Kannst du mal bei dir die Zeile 565 in

Code: Alles auswählen

        if ($this->_aCfgMR['prevent_duplicated_content'] == 1 && !isset($_GET['noex'])) {
ändern und prüfen, ob es dann passt?

Gruß
xmurrix
CONTENIDO Downloads: CONTENIDO 4.10.1
CONTENIDO Links: Dokumentationsportal, FAQ, API-Dokumentation
CONTENIDO @ Github: CONTENIDO 4.10 - Mit einem Entwicklungszweig (develop-branch), das viele Verbesserungen/Optimierungen erhalten hat und auf Stabilität und Kompatibilität mit PHP 8.0 bis 8.2 getrimmt wurde.

JochBec
Beiträge: 54
Registriert: Sa 18. Dez 2004, 15:11
Kontaktdaten:

Re: MR 100% scheint nicht zu klappen

Beitrag von JochBec » Fr 18. Feb 2011, 09:07

Mein Held!

Das scheint perfekt zu funktionieren, zumindest habe ich keine Fehler bisher ausmachen können. :mrgreen:

Jetzt wird wirklich auf die Fehlerseite geroutet sobald auch nur ein Zeichen im URL nicht stimmt. Perfekt!

Tausend Dank!!

Jochen

Gesperrt