We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8959
    • 3 Posts
    Hello


    In the .htaccess file, it usually says

    # For Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


    I changed the last line into

    # For Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*\.htm)$ index.php?q=$1 [L,QSA]


    I did this because obviously every file is passed through modx otherwise. My extension is ".htm". It did this because slimstats recorded EVERY file, since it adds the header to everyfile being accessed. But I don’t want it to record css / js files.

    (Just a sidenote: slimstat executes this line OnWebPagePrerender

    if (!isset($_SESSION['mgrValidated'])) { @include_once( $_SERVER["DOCUMENT_ROOT"]."/assets/plugins/slimstat/stats_include.php" ); }


    I tried to change it into

    if (!isset($_SESSION['mgrValidated']) && isset($modx->documentIdentifier)) { @include_once( $_SERVER["DOCUMENT_ROOT"]."/assets/plugins/slimstat/stats_include.php" ); }


    but it doesn’t prevent slimstat to record .css files... which is why I went for the htaccess solution.)


    So: this works fine so far! Maybe it even speeds up the server, since modx doesn’t have to foreward css files. BUT: Can anyone answer me if this will harm some future modification? I.e. I was thinking of maybe some plugin that gathers information via
    www.domain.com/contact.htm?variable=foo
    . I don’t know if this would be done somewhere or something else I currently cannot think of because I assume there was some reason to have the standard line in the htaccess file like it is.

    Now that I think of it, the described example could be covered with

    RewriteRule ^(.*\.htm.*)$ index.php?q=$1 [L,QSA]


    but... I don’t know. Any suggestions?