• Resolved stonegauge

    (@stonegauge)


    I installed 2.0 to a two websites that are live on the net — https://www.zimmermann2006.com and https://www.sticksoffire.com (just for reference). I had to contact my hosting’s support people because, for soem reason unknown to me, stats that are posted on my hosts server (the host is Dreamhsot BTW) weren’t showing up for some reason and redirecting me to the main pages of said websites.

    Support got back to me and noted that HTAccess (default install of HTaccess at that) was posting lines that were preventing the stats link from working::

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php

    Now, seeing my HTAccess files (which I hadn’t viewed until talking with support) contain not much more than this, is it going to break something if I remove these trouble lines from my HTAccess files on said sites listed above?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter stonegauge

    (@stonegauge)

    Yeah, that cauxses a problem all right — now I can’t get to any of the site pages…. blah. (this problem was fixed by just re-approving permalink structure — butttt the domain I am trying to access for server stats becomes unavalible again)

    Thread Starter stonegauge

    (@stonegauge)

    This isn’t resolved in Full but there was a fix presented to me by Dreamhost tech support. It can be found here:

    https://wiki.dreamhost.com/index.php/Making_stats_accessible_with_htaccess

    Unfortunately, that doesn’t work with 2.0. Removing that rewrite rule will actually get you to the directory. (You’ll get the password prompt if it’s protected.) It still doesn’t show you stats, though, just a 404.

    WP doesn’t appear to write anything to .htaccess anymore. So, what might have changed in 2.0 that would affect this…?

    Resolved? What’s the answer? ??

    Correction: Nothing seems to be *different* .htaccess-wise between 1.5 and 2.0. Just suddenly stopped working on upgrade. :\

    Thread Starter stonegauge

    (@stonegauge)

    It was resolved as there is a resolution presented on Dreamhost’s wiki….

    Many CMS and blog tools install a .htaccess file that makes our stats unreachable, including our WordPress 2.0 one-click install. They usually look something like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php
    </IfModule>
    # END WordPress

    To fix this you need to add the following lines to your .htaccess immediately after the the RewriteBase line

    RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/failed_auth.html$
    RewriteRule ^.*$ – [L]

    So the final .htaccess file would look like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/failed_auth.html$
    RewriteRule ^.*$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php
    </IfModule>
    # END WordPress

    Thread Starter stonegauge

    (@stonegauge)

    OK this is NOT resolved.

    For soem reason, every time I upload an edited .htaccess file, it works for a little bit and then stops working and reverts back to the original HTaccess file…

    Thanks for pointing out that fix, stonegauge. It worked perfectly for me.

    This plugin should take care of it.

    <?php
    /*
    Plugin Name: Dreamhost Stats
    Plugin URI: https://atastandstill.com
    Description: Prevents WordPress from intercepting the Dreamhost stats page by modifying the .htaccess file.
    Author: Roshan Gupta
    Version: 1.0
    Author URI: https://atastandstill.com/
    */

    function enable_dreamhost_stats($content) {
    if (strpos($content, ‘RewriteBase /’) !== FALSE) {
    $content = str_replace(‘RewriteBase /’,
    ‘RewriteBase /’ . “\n” . ‘RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]’ . “\n” .
    ‘RewriteCond %{REQUEST_URI} ^/failed_auth.html$’ . “\n” . ‘RewriteRule ^.*$ – [L]’, $content);
    }
    else {
    $content = str_replace(‘RewriteEngine On’,
    ‘RewriteEngine On’ . “\n” . ‘RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]’ . “\n” .
    ‘RewriteCond %{REQUEST_URI} ^/failed_auth.html$’ . “\n” . ‘RewriteRule ^.*$ – [L]’, $content);
    }
    return $content;
    }

    add_filter(‘mod_rewrite_rules’, ‘enable_dreamhost_stats’);

    ?>

    Thread Starter stonegauge

    (@stonegauge)

    Rosh, where should that code be inserted?

    Thanks

    If I were to guess, I’d put it in a new file named something like “DreamhostStats.php” and then drop it into my plugins directory to see if it flies.

    Thread Starter stonegauge

    (@stonegauge)

    OK, still issues with the plugin. Saved the code (as suggested above) as dreamhoststats.php and uploaded to my plugins directory.

    When I click ACTIVATE, I get this error message:

    Warning: Cannot modify header information – headers already sent by (output started at /home/.kafka/rtfldgr/boltsmag.com/wp-content/plugins/dreamhoststats.php:27) in /home/.kafka/rtfldgr/boltsmag.com/wp-admin/plugins.php on line 16

    Operations seemed normal and yes – I was able to view stats fine again but I heard from a friend who also tried this about there being other call errors appearing on the Admin control panel.

    When you deactivate the plugin, there is a call error that I believe is the same as the one i posted above but on line 22 instead of 16.

    Thread Starter stonegauge

    (@stonegauge)

    I’d also like to note the plugin will kill RSS feeds:

    Warning: Cannot modify header information – headers already sent by (output started at /home/.kafka/rtfldgr/boltsmag.com/wp-content/plugins/dreamhoststats.php:27) in /home/.kafka/rtfldgr/boltsmag.com/wp-rss.php on line 8

    Thread Starter stonegauge

    (@stonegauge)

    any updates on this plugin code?

    See if you have an empty/blank line in the source of the plugin at either the very top or very end. If you do, remove it.

    more here

    Thread Starter stonegauge

    (@stonegauge)

    One single space after the closing tag. Sheesh.

    That solves the ADMIN errors. Unfortunately after the fix is employed, the plug in doesn’t work any more. type in the “domain.ext/stats” in the browser and you get sent to the main page of your website instead of dreamhost stats.

    *sigh*

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘HTAccess Rule problem’ is closed to new replies.