Forum Moderators: phranque

Message Too Old, No Replies

Using awstats

         

tuckker

11:51 am on Jan 9, 2008 (gmt 0)

10+ Year Member



Currently I have the following in my .htaccess:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

However when I enter any folders which does not exist, eg:
www.example.com/abc

it shows my www.example.com mainpage by default.

However when I access :
www.example.com/awstats
it shows the mainpage (wordpress) instead of awstats. however awstats folder exists with its own files etc.

Any idea how to fix this?

[edited by: jdMorgan at 5:09 pm (utc) on Jan. 9, 2008]
[edit reason] example.com & formatting [/edit]

jdMorgan

5:13 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I understand what you're saying, it sounds like there is a problem outside of this code.

The code says:
If requested URL does not resolve to an existing file AND
If requested URL does not resolve to an existing directory THEN
Rewrite requests for any (non-blank) URL-path to example.com/index.php

However, since I don't know how your site is set up, or how it is supposed to work, that's all I can offer. Hopefully, that may help you narrow down the problem.

Jim

tuckker

5:30 pm on Jan 9, 2008 (gmt 0)

10+ Year Member



Thanks for your response. :)

Well, for some reason , when I access:
www.domain.com/awstats/awstats.pl, it will still resolve to index.php. I have verified that I have the file over at awstats/awstats.pl

But if I create another directory and put files in it, and open that file, it works...

Suggestions? Or is it possible to edit the Rewrite condition to ignore one directory? If yes, how do I modify it to ignore the folder awstats?

P.s: Also if I rename the .htaccess, I will be able to access awstats... So the prob is with .htaccess...

jdMorgan

8:08 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is the path to /awstats Aliased in httpd.conf? If so, you may need to 'reconstruct' the path in order to check it. For example, build the path using %{DOCUMENT_ROOT}<additional-path>%{REQUEST_URI} instead of using %{REQUEST_FILENAME}.

In other words, the most likely problem is that %{REQUEST_FILENAME} is not resolving to the correct filepath for some reason. Therefore, the 'file exists' and 'directory exists' checks fail even for existing files/dirs.

You can expose the path by using a redirect. Use a (temporary!) rule like this to see the REQUEST_FILENAME path in your browser address bar:


RewriteRule ^awstats/(.*)$ http://www.example.com/$1?FilePath=%{REQUEST_FILENAME} [R=301,L]

That should show your home page, but with the value of %{REQUEST_FILENAME} showing as a 'fake' query string -- as long as no other rules interfere with it.

Jim

tuckker

8:17 pm on Jan 9, 2008 (gmt 0)

10+ Year Member



the server is hosted by a 3rd party company so it would be near to impossible to touch or even rebuilt the correct path.

Alias, that i'm not too sure - but I'm seeing the folder "awstats" in my File Manager tho :P

Is there anyway to fix this issue by modifying .htaccess since this is the file which is actually causing the issue...?

Thanks for your help again Jim!

jdMorgan

4:22 am on Jan 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What were the results of the test described above?

By 'build' a path, I am not suggesting anything that you cannot do. What I mean is to replace


RewriteCond %{REQUEST_FILENAME} -f

with something like

RewriteCond %{DOCUMENT_ROOT}<extra_path_info>/%{REQUEST_URI} -f

so that the correct directory is checked for "file exists."

Alternatively, you might try simply disabling the rule if the request is for /awstats by adding another RewriteCond ahead of the others:


RewriteCond %{REQUEST_URI} !^/awstats/

Jim

[edited by: jdMorgan at 4:23 am (utc) on Jan. 10, 2008]

tuckker

5:25 am on Jan 10, 2008 (gmt 0)

10+ Year Member



I used:
[codes]RewriteCond /domains/example.com/public_html/%{REQUEST_FILENAME}!-f
RewriteCond /domains/example.com/public_html/%{REQUEST_FILENAME}!-d
[/codes]
And the result is:
Awstats works.
www.example.com/12312 (or any unknown directory) gives Internal 500 error.
www.example.com gives 500 error too...

The error log shows:
[codes][Thu Jan 10 00:21:41 2008] [error] [client 102.111.xx.xx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[/codes]
Hmm... Maybe the rewritecond is ... wrong?

tuckker

1:13 pm on Jan 12, 2008 (gmt 0)

10+ Year Member



any updates JIm?

I further tried with:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}!^/awstats$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}!^/awstats/(.*)

and it didn't work too... Hmmm..

jdMorgan

5:10 pm on Jan 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Me update? No, this is your site. I was hoping you might try some of the suggestions I posted above...

Jim