Making Stats Accessible to the Public

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,113
Location
California
Making Stats Accessible to the Public Mini How-To
Jeff Lasman, [email protected] 07/07/04 08:26
======================================
Making your Webalizer stats, as maintained by DA, accessible to the public is quite easy under DA as long as you have shell access.

From your public_html directory, create a symbolic link:

stats -> ../stats

Here's how:
Code:
ln -s ../stats stats

After that you can look at the stats this way:

http://www.example.com/stats

If you don't have shell access your hosting provider will have to do it for you.

When you contact your hosting provider you should probably point them to this How-To so they see how easy it is :) .
 
Looks like this is the place to be for Webalizer. Now how can I add a .htaccess to it so that it requires a username/password for access?


Big Wil
 
You should be able to password protect the stats directory through the filemanager.
 
Nope. I tried that one long before posting. It doesn't give that as an option. The only option is to rename the directory.

stats 0.50k 755 Rename Oct 20 00:30 2004 root root

Big Wil
 
You certainly can add password protection, though you'll have to do it through the shell.

The downside is simple: the password will be required even when entering through the DA interface.

Jeff
 
Just an idea:
create stats dircetory inside public_html and set up mod_rewrite redirect to access ../stats directory.

Since it's not a symbolic link, you can have a password protection in that directory that will not affect stats available via DA.
 
jlasman said:
You certainly can add password protection, though you'll have to do it through the shell.

Here is a workaround to those who don't like to mess with the shell :

Create a temporary directory under public_html and password protect it. Then move .htaccess file to stats directory outside public_html (with File Manager) and delete the temp directory.

Make sure the name of temporary directory is something you will never use again.
 
Webcart said:
Just an idea:
create stats dircetory inside public_html and set up mod_rewrite redirect to access ../stats directory.
I believe mod_rewrite works by rewriting the URL in the browser. If it does, then ../stats won't work because the stats directory is outside the webpsace.

Jeff
 
jlasman said:
I believe mod_rewrite works by rewriting the URL in the browser. If it does, then ../stats won't work because the stats directory is outside the webpsace.

Jeff

That's partially correct: mod rewrite indeed supports external redirects.
However, it also supports internal redirects, which basically map URLs into physical paths on the disk.

Here are some useful links for you:

http://httpd.apache.org/docs/mod/mod_rewrite.html
http://httpd.apache.org/docs/misc/rewriteguide.html
 
I just read both of the references and the only thing I saw would rewrite to the ~username.

That's all I had known of previously to reading them.

However to do this in DA you'd need to use something like:

http:/12.34.56.78/~username/domains/domainname/stats

which I don't think is what most people would want.

Nor would it charge such requests against the user's limits.

If you know of some way to do it that keeps it inside the actual URL of the domain, please let me know; I'd like to learn.

Thanks.

Jeff
 
You can replace ~user with anything you want, that example just demonstrates a way to access a physical location on the disk (/u/user in that example).

The great thing about mod_rewrite is that you can hardcode the absolute path inside mod rewrite rule, you dont have to put any part of it in URL. This is only available within httpd.conf context, though. I think that in .htaccess you are limited to your DocumentRoot directory.

Here is a working example.
Code:
[root@~ webcart]#
[root@~ webcart]# cd /home/USER/domains/DOMAIN/public_html/
[root@/home/USER/domains/DOMAIN/public_html webcart]# mkdir demo
[root@/home/USER/domains/DOMAIN/public_html webcart]# cd demo
[root@/home/USER/domains/DOMAIN/public_html/demo webcart]# ln -s /home/USER/domains/DOMAIN/stats stats
[root@/home/USER/domains/DOMAIN/public_html/demo webcart]# echo 'RewriteRule ^demo2/(.*) demo/stats/$1' >> ../.htaccess
[root@/home/USER/domains/DOMAIN/public_html/demo webcart]#

Now, point your browser to http://DOMAIN/demo2/

This set up will obey all rules you put in public_html/demo/.htaccess.
For example, try:
Code:
echo "Deny from all" > .htaccess

and refresh the page.
 
Having trouble trying to protect the stats directory using the symbolic link method. Can someone point a quick how to.

thanks

Jon
 
jjma said:
Having trouble trying to protect the stats directory using the symbolic link method. Can someone point a quick how to.

thanks

Jon

The easiest method woudl be to do the following:

cd /home/USERNAME/domains/DOMAINNAME/public_html
mkdir protected_area
cd protected_area
ln -s /home/USERNAME/domains/DOMAINNAME/stats stats

then password protect directory protected_area via DA.
Your stats will be accessible via http://DOMAINNAME/protected_area/stats

Hope that helps.
 
Back
Top