Page 1 of 1
mod_rewrite/cms/awstats problem
Posted: Thu Jan 10, 2008 4:29 am
by uagrad92
I recently switched to a new server (Apache 2.2.6, MySQL 5.0.45, php 5.2.5) with my webhost and my CMS website on the new website will not display the awstats page but my other websites (non-CMS now but will be soon) do not have this problem. This leads me to believe it has something to do with the mod_rewrite rules needed for pretty urls. I'm using the example .htaccess that is listed in the documention and it is working fine with CMS and worked fine on the old server. I'm clueless on how to resolve this. Any suggestions?
Re: mod_rewrite/cms/awstats problem
Posted: Thu Jan 10, 2008 5:00 am
by nivekiam
awstats is a web log analysis package
http://awstats.sourceforge.net/
What sort of error message are you getting? A missing page (404) message? I'd make sure there is an awstats directory in the same directory as your CMSms directory?
I don't have awstats installed on my webserver (it's a resource hog), but I am able to access other directories under my CMSms directory and I have the same rewrite rules and Pretty URLs enabled.
If this doesn't help are you able to post a link to your site?
Re: mod_rewrite/cms/awstats problem
Posted: Thu Jan 10, 2008 2:37 pm
by uagrad92
I'm getting a 404 Not Found error when I try to view the awstats page. The awstats directory is installed at the root level as is CMS. In other words if I'm looking at a directory listing I see /awstats, /admin, /doc,/images,/uploads,/tmp,index.php, config.php,etc. When the .htaccess is removed the awstats page begins to work so there is something in the rewrite rules that is causing this. Even though it worked on the old server and not the new one my webhost isn't providing any help. Here is a link to the website:
http://www.inthemastersservice.org.
Re: mod_rewrite/cms/awstats problem
Posted: Thu Jan 10, 2008 4:38 pm
by Pierre M.
Hello uagrad92,
you have web software A (awstats) and web software B (CMSms) installed on the same web server. Software B provides documentation about activating an option (pretty URLs) in the webserver. You have tuned the webserver to enable the feature. But by doing this you have also broken something between the webserver and software A.
Hence the answer is in the documentation of the link between the webserver and software A. This is not a software B (CMSms) issue. I'm sorry, I don't know awstats web set up. As said by nivekiam I find it usefull as an offline tool. Try to exclude awstats (rewritecond...) from the misguiding rewriting rules.
Pierre M.
Re: mod_rewrite/cms/awstats problem
Posted: Thu Jan 10, 2008 6:38 pm
by Nullig
You could try adding:
RewriteCond %{REQUEST_URI} !^/awstats directory/.*
before the other rewrite conditions.
Nullig
Re: mod_rewrite/cms/awstats problem
Posted: Thu Jan 10, 2008 7:12 pm
by uagrad92
Nullig wrote:
You could try adding:
RewriteCond %{REQUEST_URI} !^/awstats directory/.*
before the other rewrite conditions.
Nullig
That works! Thanks! I tried different things close to what you suggested but I didn't understand mod_rewrite enough to know what I was doing. For anyone else that may be having a similar problem, here is what my .htaccess file looks like now:
AddType application/x-httpd-php .html .php
DirectoryIndex index.php
RewriteEngine On
# BEGIN Optional settings
# Turns off directory browsing
# not absolutely essential, but keeps people from snooping around without
# needing empty index.html files everywhere
Options -Indexes
# No sense advertising what we are running
ServerSignature Off
# END Optional Settings
# BEGIN CMSMS and Rewrite Rules
# Make sure you have Options FollowSymLinks
# and Allow on
# Might be needed in a subdirectory
#RewriteBase /
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a ""
RewriteCond %{QUERY_STRING} (\|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# END Filtering
# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_URI} !^/awstats.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS
# END Rewrite rules