View Single Post
Old 15th February 2007, 11:16
Ovidiu Ovidiu is offline
Senior Member
Join Date: Sep 2005
Posts: 1,239
Thanks: 70
Thanked 21 Times in 17 Posts
Question howto add these apache directives?

I need one folder i.e. /var/www/web1/web/folder/ to have these directives applied to:

# 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

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

# 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: RewriteRule ^([0-9]+)/(.+)$$1&file=$2 [L,NC]

# Turn on mod_rewrite
RewriteEngine On

# This block will disable image hotlinking. The images will only be viewable
# through a page on your site. This will enable you to put ads or whatever you want
# around the image. If you disable this, the images can be viewed directly.
# To disable, comment out the two lines below.
# Enter your domain name in the line that starts with RewriteCond. Here are some examples:
# Example 1: RewriteCond %{HTTP_REFERER} !^http://(www\.)?celerondude\.com/? [NC]
# Example 2: RewriteCond %{HTTP_REFERER} !^http://(www\.)?google\.com/? [NC]
# If you get a 404 error, enter the absolute path to view.php instead of just ../view.php.
# RewriteCond %{HTTP_REFERER} !^http://localhost/? [NC]
# RewriteRule ^([0-9]+)/(.+)$ ../view.php?userid=$1&file=$2 [L,NC]

# Use the uploader to view the image instead of viewing it directly.
# If you get a 404 error, enter the absolute path to view.php instead of just ../view.php.
RewriteRule ^view/([0-9]+)/(.+\.(jpe?g|gif|bmp|png))$ ../view.php?userid=$1&file=$2 [L,NC]

# Very important, do not remove. Required for bandwidth tracking.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^([0-9]+)/(.+)$ ../file.php?userid=$1&file=$2 [L,NC]
btw. the subdomain serves its files from this folder by an entryinside .htaccess using a rewrite.

can you give me some hints? maybe some parts of the directives are unnecesary? I am using a perfect debian 3.1 install with latest ispconfig.
Reply With Quote
Sponsored Links