Problem with /stats access

Discussion in 'ISPConfig 3 Priority Support' started by jpcyrenne, Dec 23, 2014.

  1. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    Good Day,

    A WordPress site has been installed and seems to override

    http://site.com/stats

    I get a broken site (the same as the good site). For sure WP is taking over /stats.

    I tried to add an Alias in the Options/Apache Directives with no success?

    Alias /stats /var/www/clients/client1/web4/web/stats


    Any suggestions?

    Thanks ahead,

    JP
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which exact error message do you get in the error.log of the site when you try to access the stats folder?
     
  3. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    I have no error in the logs, it's most probably the CMS (Word Press) that generates the content according to the URL.

    Maybe it's a redirect that needs to be done in an .htaccess file?

    The first 2 lines of the access log show a 301 redirection to a 404. That's the CMS. Just wondering what you or your other ISPConfig users do to fix this issue with a CMS (Word Press in my case).

    Site : http://www.sauvonsplusdevies.quebec/stats/

    Thanks,

    JP


    # tail -f /var/log/httpd/access_log

    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /stats/index.php HTTP/1.1" 301 20 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /stats/ HTTP/1.1" 404 4346 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=3.1.8.2 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/themes/roots/assets/css/royal-slider/skins/minimal-white/rs-minimal-white.css?ver=4.0.1 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/wpml-cms-nav/res/css/navigation.css?ver=1.4.5 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/wpml-cms-nav/res/css/cms-navigation-base.css?ver=1.4.5 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/wpml-cms-nav/res/css/cms-navigation.css?ver=1.4.5 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/themes/roots/assets/css/main.min.css?ver=d42b9da69d376e82260bbe6f9e6e003d HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravityforms/css/formreset.css?ver=1.8.9 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravityforms/css/formsmain.css?ver=1.8.9 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravityforms/css/readyclass.css?ver=1.8.9 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravityforms/css/browsers.css?ver=1.8.9 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravityforms-html5-placeholders/css/gravityforms-placeholders.css?ver=2.7 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravityforms-html5-placeholders/js/gravityforms-placeholders-fallback.min.js?ver=2.7 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
    70.54.167.78 - - [23/Dec/2014:15:29:15 -0500] "GET /wp-content/plugins/gravity-forms-placeholder-support-add-on/gfplaceholderaddon.js?ver=1.0 HTTP/1.1" 304 - "http://www.sauvonsplusdevies.quebec/stats/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0"
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    May you please post the .htaccess file of this website.
     
  5. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    # less .htaccess

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


    Can we add something like this to the Options / Apache Directives in case developers override the .htaccess (git) ?

    RewriteBase /stats
    RewriteRule ./stats/index\.php$ - [L]



    stats]# ll
    total 120
    -rw-r--r-- 1 root root 3006 Dec 21 00:30 ctry_usage_201412.png
    -rw-r--r-- 1 root root 2825 Dec 21 00:30 daily_usage_201412.png
    -rw-r--r-- 1 root root 1921 Dec 21 00:30 hourly_usage_201412.png
    -rw-r--r-- 1 web4 client1 2173 Dec 23 15:26 index.php
    -rw-r--r-- 1 root root 80486 Dec 21 00:30 usage_201412.html
    -rw-r--r-- 1 root root 2285 Dec 21 00:30 usage.png
    -rw-r--r-- 1 root root 15004 Dec 21 00:30 webalizer.current
    -rw-r--r-- 1 root root 2876 Dec 21 00:30 webalizer.hist

    Thanks,

    JP
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Pleastry to add this in a .htaccess file that you add inside the stats folder. A .htaccess file in stats should override the one in the web folder. Adding this in the apache directives will not work most likely as .htaccess overrides the settings in the vhost file.
     
  7. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    Good Day, I tried to add it to the .htaccess of the /stats folder with no success. It never even asked for the user password for the stats page. I guess the root folder .htacess never sends it to /stats/index.php

    I tried to put the rule in the main root folder with no success either. it keeps asking me for user password on every link I would click (it's the good admin and password combination for the stats page).

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /stats/
    RewriteRule ^/stats/index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /stats/index.php [L]
    </IfModule>


    Thanks,

    JP Cyrenne
     
  8. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    I'm reading up on it...

    I tried these with no success :

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^stats - [L,NC]
    ...

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^stats/ - [L]
    ...

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(stats)($|/) - [L]
    ...


    It's my understanding that if a page exists i should be able to access it because of these rules (but doesn't work obviously):

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    I even read that a child process would override a parent so I tried RewriteEngine Off in the .htaccess of the stats folder (with no success):

    ## turn off rewrite engine
    RewriteEngine Off

    AuthType Basic
    AuthName "Members Only"
    AuthUserFile /var/www/clients/client1/web4/web/stats/.htpasswd_stats
    require valid-user


    Wether I ask for http://site.com/stats or http://sote.com/statsww I get the same error. I figure we need to ignore a rewrite to /stats right in the main root folder...


    Thanks,

    JP
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Just for a test, did you try to rename the .htaccess file in the web root to see if the issue does not exist when there is no .htaccess for wordpress?
     
  10. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    I renamed the .htaccess, I get the password window, I enter the admin:passwd and get an error.

    Not Found
    The requested URL /stats/awsindex.html was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/2.2.15 (CentOS) Server at www.sauvonsplusdevies.quebec Port 80


    1) So we know it's a WordPress .htaccess rewriteRule rewriteCond that has to be tweaked... Rewrite everything but don't touch /stats.
    It's a bit special that you don't have this issue with all the WP sites and ISPConfig servers out there. Maybe not everyone does nice likns, but some must do? It's got to be a silly thing...

    2) For the stats page not found error?
    drwxr-xr-x 3 web4 client1 4.0K Jan 6 20:58 stats
    # ls -lah stats/
    total 140K
    drwxr-xr-x 3 web4 client1 4.0K Jan 6 20:58 .
    drwxrwxr-x 9 web4 client1 4.0K Jan 6 21:24 ..
    drwxr-xr-x 2 root root 4.0K Jan 2 00:30 2014-12
    -rw-r--r-- 1 web4 client1 3.0K Dec 21 00:30 ctry_usage_201412.png
    -rw-r--r-- 1 web4 client1 2.8K Dec 21 00:30 daily_usage_201412.png
    -rw-r--r-- 1 web4 client1 1.9K Dec 21 00:30 hourly_usage_201412.png
    -rwxr-xr-x 1 root root 126 Jan 6 20:58 .htaccess
    -rwxr-xr-x 1 web4 client1 40 Dec 21 21:42 .htpasswd_stats
    -rw-r--r-- 1 web4 client1 2.2K Jan 6 20:58 index.php
    -rw-r--r-- 1 web4 client1 79K Dec 21 00:30 usage_201412.html
    -rw-r--r-- 1 web4 client1 2.3K Dec 21 00:30 usage.png
    -rw-r--r-- 1 web4 client1 15K Dec 21 00:30 webalizer.current
    -rw-r--r-- 1 web4 client1 2.9K Dec 21 00:30 webalizer.hist

    2.1) There is no page to where it redirects (/stats/awsindex.html) after i enter the .htaccess admin:passwd ? Should it redirect to /stats/index.php? Where would I change this?

    2.2) Maybe everything was configured on Dec 21st, shouldn't I see some Jan dates in all of this?

    Thanks,
    JP Cyrenne
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Is the website set to awstats or webalizer statistics on the stats tab of the website settings in ispconfig?
     

Share This Page