Bandwidth Theft Question?

kuyenmotdivad

Well-known member
Hi,

How come if I put a .htaccess file in the root to protect from bandwidth theft and install XF in /community/ the script in the root will not protect the /community/ folder unless I had that .htaccess file in that folder as well?

EG - I have to scripts exactly the same here.

/.htaccess
/community/.htaccess

Any ideas?
 

Brogan

XenForo moderator
Staff member
It should work.
I have hotlinking enabled on my domain and only the root .htaccess is required.
 

Brogan

XenForo moderator
Staff member
This is what I have in mine.

Code:
RewriteRule .*\.(jpeg|gif|bmp|png|jpg)$ images/hotlink.jpg [L]
 

kuyenmotdivad

Well-known member
I got this....

/community/.htaccess
PHP:
<IfModule mod_rewrite.c>
  RewriteEngine On

   RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^.*$ - [NC,L]
  RewriteRule ^(data|js|styles|install) - [NC,L]
  RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 

David McHenry

Active member
IF YOU HAVE AN .HTACCESS FILE FOR XENFORO IN YOUR COMMUNITY DIRECTORY THEN THE ROOT .HTACCESS WON'T OVERRIDE OR AUTOMATICALLY APPEND ITSELF TO IT. (OR ANY OTHER SUBFOLDER FROM ROOT.
 

kuyenmotdivad

Well-known member
but I have to have one in /community/ as theres one included with this content. So I'm stuck with both .htaccess files with the same content in them both (partly)

PHP:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 

kuyenmotdivad

Well-known member
The .htaccess file thats included with XF would it be better to put all files in my /community/ folder and the XF .htaccess in my root, like this?

/.htaccess (including the lines from the XF .htaccess)
PHP:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
/community/ (all other files here but not the .htaccess file)
 

David McHenry

Active member
but I have to have one in /community/ as theres one included with this content. So I'm stuck with both .htaccess files with the same content in them both (partly)

PHP:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
THE ONLY PART THAT WOULD BE DOUBLE IS THE PART FOR HOTLINK PROTECTION.

IN YOUR ROOT .HTACCESS
Code:
RewriteRule .*\.(jpeg|gif|bmp|png|jpg)$ images/hotlink.jpg [L]
THEN IN YOUR /COMMUNITY/.HTACCESS
Code:
XENFORO DEFAULT HTACCESS
RewriteRule .*\.(jpeg|gif|bmp|png|jpg)$ images/hotlink.jpg [L]
ALSO ITS INTERNATIONAL CAPS LOCK DAY. HENCE MY CONSTANT USAGE OF CAPSLOCK
 
Top