Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-12 10:32:58

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

.htaccess and awstats

I’ve posted a similar topic back in september but with no results. Found some workarounds in the end but they stopped working with the 4.0.1 upgrade.

I am running TXP 4.0.1 r888 and I can’t seem to get AWstats to run with TXP’s .htaccess:
<pre><code>#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options +SymLinksIfOwnerMatch
#RewriteBase /textpattern

&lt;IfModule mod_rewrite.c&gt; RewriteCond %{REQUEST_URI} ^/awstats/(.*)$ [OR]

RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L] RewriteRule ^(.*) index.php &lt;/IfModule&gt;

php_value register_globals off</code></pre>

I can access http://domain.com/awstats/ without any probs (same for any other files within it EXCEPT the .pl ones), but when I go http://domain.com/awstats/awstats.pl apache says Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/httpd/vhosts/domain.com/httpdocs/awstats/awstats.pl.

I have been reading quiet a few posts over here (TXP works but other scripts dont work because TXP. mod_rewrite issue?, Stats page redirects to main) but things just don’t work for me. I even tried putting Options +FollowSymLinks and Options +SymLinksIfOwnerMatch in .htaccess but it still won’t work.

Any help will be appreciated. Cheers!

[Oh, forgot to mention that by uncommenting everything that is in the IfModule directive, AWstats works fine.]

Last edited by gerhard (2005-11-12 12:28:12)

Offline

#2 2005-11-12 17:04:54

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: .htaccess and awstats

Your awstats line is placed before RewriteEngine On, so url rewriting is not enabled at the time that line is executed. Try placing it just after it.

But also – does the awstats directory exist? If so, your rule should be unnecessary. The first set of Textpattern rewrite rules (the three lines prior to RewriteRule ^(.*) index.php) are there to allow passthrough for all requests for files or directories that actually exist in the filesystem.

Offline

#3 2005-11-12 17:23:04

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: .htaccess and awstats

Yes Andrew, you are right, there is no need for rewrite rules because the directory is already there. However, when I try accessing http://domain.com/awstats/awstats.pl?conf=domain.com, it keeps giving 403s with the error I’ve mentioned in my first post (FollowSymLinks etc.).

Even plain <em>.pl</em> files (no <em>?=conf</em> etc. afterwards) it doesn’t like.

If I comment ALL rewrite rules & conditions, it works fine:

<pre><code>#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options +SymLinksIfOwnerMatch
#RewriteBase /textpattern

&lt;IfModule mod_rewrite.c&gt;
#RewriteEngine On

#RewriteCond %{REQUEST_URI} ^/awstats/(.*)$ [OR]
#RewriteCond %{REQUEST_URI} ^/awstats/awstats.pl?conf=domain.com$ [OR]

#RewriteCond %{REQUEST_FILENAME} -f [OR]
#RewriteCond %{REQUEST_FILENAME} -d
#RewriteRule ^(.+) – [PT,L]

#RewriteRule ^(.*) index.php
&lt;/IfModule&gt;

php_value register_globals off</code></pre>

I have a feeling the dots that appear in the URI are screwing with it (<em>.pl</em> and then <em>.com</em>). But why doesn’t it like plain <em>.pl</em> files either? It works fine with <em>.txt</em> or <em>.pm</em> files…

The whole thing feels like one of Apache’s top 10 mysteries.

Cheers mate ; ).

Last edited by gerhard (2005-11-12 18:02:23)

Offline

#4 2005-11-12 17:45:49

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: .htaccess and awstats

Could be a permissions thing – since it’s a cgi script it needs to be chmod 755 doesn’t it?

Offline

#5 2005-11-12 17:50:11

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: .htaccess and awstats

Oh wait, so that means you got it working?

Offline

#6 2005-11-12 17:51:51

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: .htaccess and awstats

Chmodded everything in <code>httpdocs</code> that starts with <code>aws*</code> to <code>755</code> but still nada.

I think we need here either Zem, Sencer or Mary. : )

##########################################################
Heck you’re fast (I didn’t get to reply to the first one and you already posted another one).

Yes, it works fine IF I comment the rewrite bit in TXPs .htaccess. This however breaks clean URL support (something I don’t want to do).

Last edited by gerhard (2005-11-12 17:58:30)

Offline

#7 2005-11-12 17:57:41

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: .htaccess and awstats

You said that when you uncommented all rules, it worked. FollowSymLinks may be the key.

Edit: Ok, so you meant only if you remove all of Textpattern’s fiddly bits. Hm… if I had more experience with AWStats I’d be of more help. It is such a pain to setup.

Last edited by Andrew (2005-11-12 17:59:36)

Offline

#8 2005-11-12 18:05:52

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: .htaccess and awstats

Btw, I think something is needed for your AWStats install directory…

Options +FollowSymlinks +ExecCGI
AddHandler cgi-script cgi pl
DirectoryIndex awstats.pl

Also, what happens when you uncomment Options +FollowSymLinks in the default Textpattern .htaccess, without adding any AWS rules?

Last edited by Andrew (2005-11-12 18:12:31)

Offline

#9 2005-11-12 18:25:18

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: .htaccess and awstats

One last attempt. Is your awstats directory aliased? If so, it doesn’t really exist under your rewritebase does it? What if you try something like this (pulled from a forum I read about someone under WordPress who experienced the same problem as you’re experiencing):

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options +SymLinksIfOwnerMatch
#RewriteBase /textpattern

<IfModule mod_rewrite.c>
 RewriteEngine On

 RewriteCond %{REQUEST_URI} ^/awstats/
 RewriteRule .* - [L]

 RewriteCond %{REQUEST_FILENAME} -f [OR]
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^(.+) - [PT,L]

 RewriteRule ^(.*) index.php
</IfModule>

php_value register_globals off

.

Offline

#10 2005-11-12 18:28:25

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: .htaccess and awstats

Nope, it doesn’t work. BUGGER!

Uncommenting <code>Options +FollowSymLinks</code> was the first thing that I did after checking the logs. Needless to say it didn’t work…

Well, after having spent almost 1 day with this bastard, I think it’s time to take a shortcut: put awstats in a subdirectory. I still think it’s worth getting to the bottom of this though. Unfortunately, I don’t have more time for this bugger.

Cheers Andrew, you’re a star ; ).

###########################################
Tom Raftery’s tip, yep. This AWstats issue is so bloody frustrating!

No, awstats dir is the app itself. Didn’t really want symlinks pointing up my server’s public tree. It uses more space, but it’s more secure this way (or so <em>methinks</em>).

Last edited by gerhard (2005-11-12 18:36:05)

Offline

#11 2005-11-12 21:28:20

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: .htaccess and awstats

Try setting RewriteBase to /, and/or removing the leading slash from ^/awstats/. mod_rewrite is like this – there’s no solution that works everywhere. Keep experimenting and read the docs (but bear in mind they’re sometimes wrong).


Alex
tstate

Offline

#12 2005-11-13 01:37:22

graumeister
Plugin Author
From: Ban Bang Por, Samui, Thailand
Registered: 2005-01-16
Posts: 167
Website

Re: .htaccess and awstats

hi gerhart, could it be, that the server indeed has no right to read awstats (the dir)? the 403 at the beginning says something like this. the rewrite-rules

RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d

should catch the dir. and it seems that they do.

try the original .htaccess again but set Loglevel to 10 and look into the log.

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriteloglevel


Samui? Samui! (about the life as farang in thailand)
David’s Neighbour

Offline

Board footer

Powered by FluxBB