Forum Moderators: phranque

Message Too Old, No Replies

Awstats Forbidden

         

archangel714

7:18 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



I am still very new to .htaccess files so what I have is grabbed from online help sites. The problem that I am having is that when I turn the RewriteEngine on it makes it so that my awstats page is forbidden (403 error).

Here is the code

-------------------------------------------------------------
<Files .htaccess>
order allow,deny
deny from all
</Files>

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
RewriteRule ^(.*)$ [mysite.com...] [R=301,L,NC]

ServerSignature EMail
SetEnv SERVER_ADMIN mailto:myemail@hotmail.com

Options -Indexes
-------------------------------------------------------

I have tried tried commenting everything else out (including the rewrite rules and cond) but even with a file that only has a the RewriteEngine on the awstats is still forbidden

Awstats is located at /awstats/awstats.pl <- symlink

Thanks for any help!

jdMorgan

11:28 pm on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is nothing in the code itself that would cause this, so you apparently have a problem with the server set-up. It would be expected that using "RewriteEngine on" without the preceding "Options +FollowSymLinks" directive could cause an error, but it would be a 500-Server Error, and not a 403-Forbidden. (To clarify, using any mod_rewrite directives requires that FollowSymLinks or SymLinksIfOwnerMatch be set, either in .htaccess or at the server config level. If one of these options is not set, you get a 500-Server Error if you try to use any mod_rewrite directive.)

I'd suggest you contact your host with this problem, after removing (not just commenting-out) all of the lines except the Options and RewriteEngine directives. They may give you a line about "We don't support mod_rewrite," and if so, you may be able to get away with insisting that they should at least support being able to enable it. If not, you basically need a new host.

Be sure you are completely flushing your browser cache after changing the code. Failing to do so can lead to apparently-bizarre test results, since your browser will cache both previously-loaded pages and their corresponding server responses (such as 403 or 500 errors).

You might also want to take a look at your server error log -- It can be quite informative.

Jim

archangel714

11:32 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



well I am the host - I am running Apache 2. I will try out your comments later tonight. Thanks

archangel714

1:18 pm on Aug 7, 2008 (gmt 0)

10+ Year Member



I have gone through my virtual host file but have found nothing that would cause my awstats from loading. Here is the file

--------------------------------------------------------------------
<VirtualHost *>
ServerAdmin myemail@hotmail.com
ServerName mysite.com
ServerAlias *mysite.com

DocumentRoot /var/www/personal/
<Directory />
Options FollowSymLinks
AllowOverride none
</Directory>
<Directory /var/www/personal/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/personal-error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/personal-access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/var/www/personal/awstats/classes/"
Alias /awstatscss "/var/www/personal/awstats/css/"
Alias /awstatsicons "/var/www/personal/awstats/icon/"
ScriptAlias /awstats/ "/var/www/personal/awstats/cgi-bin/"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/var/www/personal/awstats">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Options ExecCGI -MultiViews +SymLinksIfOwnerMatch

</VirtualHost>

-----------------------------------------------------------------------

Again the problem is that when I have the rewriteEngine on in the root directory the website address changes correctly but I can't seem to access the awstats page. As soon as I comment out the rewriteEngine, awstats works again... Argh!

jdMorgan

4:33 pm on Aug 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't see anything obvious.

Disable MultiViews completely (in all contexts) if you don't use them. They generate 'rewrites' and can confuse mod_rewrite debugging.

The interference of RewriteEngine on with your awstats is even more perplexing, considering that you've got awstats ScriptAliased to a directory that does not share your .htaccess file. Look in all directories below your .htaccess file for other mod_rewrite directives that might be getting enabled.

That's all I can say without knowing what's in your error log.

Jim

archangel714

2:58 am on Aug 8, 2008 (gmt 0)

10+ Year Member



Thanks Jim, I will look into my other .htaccess but I am pretty sure that I don't have any other rewrite rules. I will also post part of the error log, but sadly that will not be for about a week due to a family trip. Hopefully you can help me out then :) cheers!

archangel714

3:14 am on Aug 19, 2008 (gmt 0)

10+ Year Member



Ok here is what my error log says...

[Mon Aug 18 23:09:12 2008] [error] [client 192.***.0.***] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/personal/awstats/cgi-bin/awstats.pl, referer: http://www.example.com/html/admin.html

[edited by: jdMorgan at 2:04 pm (utc) on Aug. 19, 2008]
[edit reason] example.com [/edit]

jdMorgan

2:02 pm on Aug 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error message says that you need to enable AllowOverride Options and then set Options +FollowSymLinks for the <Directory> in which the AwStats files are stored.

Jim

[edited by: jdMorgan at 2:04 pm (utc) on Aug. 19, 2008]