Ultimate n00b Q's - Apache, mod_rewrite, Bandwith Monitoring

RoBo

2[H]4U
Joined
Jan 5, 2007
Messages
3,520
So a few nights ago I was bored running a server 24/7 @ idle most of the time so I decided to set up a image hosting site based on CeleronDude's Uploader script. I set it up with

Apache 2.2
PHP 5.2.0
Uploder 6.1

After a few problems it seemed all good until I realised that bandwith monitoring wasn't working.
barf.gif


After a bit of research I found that a module called mod_rewrite needs to be enabled for bandwith monitoring to work, I added the below code to .htaccess in \htdocs\files

Code:
# Disable listing of user files
DirectoryIndex index.php
Options -Indexes

# Disable php in userfiles directory (recommended!!!!)
RemoveType php
<IfModule mod_php4.c>
  php_flag engine 0
</IfModule>

<IfModule mod_php5.c>
  php_flag engine 0
</IfModule>

# GET requests only
<LimitExcept GET>
  Order Allow,Deny
</LimitExcept>

# This file MUST be in the user files directory in order for bandwidth tracking to work.
# Bandwidth tracking requires your server to have the mod_rewrite module enabled. If you do not have it,
# you will probably get some Internal Server Error messages.
# To disable bandwidth tracking, comment out the lines below that start with Rewrite...or delete everything from here (this line).
# The file.php path MUST be correct in order for bandwidth tracking to work correctly.
# You can use either relative or absolute path. If none works try entering the FULL url
# to file.php as in this example below:
# EXAMPLE ONLY: 

# Turn on mod_rewrite
RewriteEngine on

# Edit the path to tracker in the line below (the default setting should work
# unless you've changed the path to the userfiles directory.
RewriteRule ^([0-9]+)/(.+)$ http://robo.webhop.biz/file.php?userid=$1&file=$2 [L,NC]            

# This is the default value in case you messed up and forgot what it looks like.
# DO NOT change this, copy it to another line, uncomment it and edit it there so you'll always have this.
# DEFAULT CONFIG: RewriteRule ^([0-9]+)/(.+)$ ../file.php?userid=$1&file=$2 [L,NC]
Is this right? Why isn't it working? Did I miss something out?

FYI: The site is www.robouploader.co.nr

Thanks for any help.

EDIT : Updated Apache and PHP.
heart.gif
 
Try adding

RewriteLog /path/to/logs/rewrite.log
RewriteLogLevel 9

to get some mod_rewrite debugging information in /path/to/logs/rewrite.log

That might shed some light on the situation.

RewriteRule ^([0-9]+)/(.+)$ http://robo.webhop.biz/file.php?userid=$1&file=$2 [L,NC]

Note that using http:// in your destination in a rewriterule will send an implied redirect to the browser, which may not be what you want.
 
I changed the rewrite rule to the default,

Code:
RewriteRule ^([0-9]+)/(.+)$ ../file.php?userid=$1&file=$2 [L,NC]
Also added

Code:
RewriteLog /data/logs/rewrite.log
RewriteLogLevel 9
to httpd.config saved and restarted Apache.

http://robo.webhop.biz/data/logs/
 
Does apache httpd have the ability to write to /data/logs/rewrite.log? Note that since your specifying an absolute path it will be off of the root directory.

Does anything appear in Apache's error logs when you try to start it with these configuration directives?
 
Back
Top