We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18839
    • 39 Posts
    Hi everyone,

    I am running MODx 0.9.6.1 with SEO friendly URL’s enabled am having trouble protecting the awstats directory on my server.

    I have this code in the .htaccess file in the MODx root dir:
    RewriteEngine On
    RewriteOptions Inherit
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
    


    and in my awstats directory which is in the root, I have this code in the .htaccess file:
    Options +ExecCGI
    DirectoryIndex awstats.pl
    
    #------ Start protect
    AuthType basic
    AuthName "Stats"
    AuthUserFile /home/serveralias/domains/domainname.com/public_html/awstats/.htpasswd
    AuthGroupFile /dev/null
    Require valid-user
    #------ End protect
    


    Entering the URL: http:www.domainname.com/awstats/ --> If I take out the code between the ’Start protect’ and ’End protect’ comments, the stats load fine, but if I add the code I get a 404 MODx page.

    Does anyone have any ideas? huh
      • 33372
      • 1,611 Posts
      Quote from: ganeshXL at Feb 07, 2008, 11:58 AM

      I think you should add
      RewriteEngine Off
      to your awstats .htaccess
      That sounds right to me also. The way that you have it now, it would probably work if you specifically loaded awstats.pl, but it’s trying to use the rewrite rules from the root directory so it isn’t finding the page based on those. You’ll find a similar .htacess file in your manager subdirectory that allows that to work properly as well.
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 18839
        • 39 Posts
        I tried adding the RewriteEngine Off to the .htaccess file in the /awstats/ directory, but it had no effect.

        If I remove the RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC] line from the .htaccess file in the webroot everything works fine, except the SEO friendly URL’s of course.
          • 18839
          • 39 Posts
          I tried again but no luck huh
          I think it has to do with the request for the .htpasswd file ?
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Check your webserver error log to see exactly what’s being requested.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org