...

View Full Version : .htaccess



carla
08-12-2002, 06:14 PM
I'm not sure if this is the right category for this question but i didnt know where to post it.Basically i'm trying to stop people direct linking using .htaccess,my host says i can use it/its supported.I followed the tutorial,wrote it in notepad,uploaded it to my main directory in ascii,renamed it once it was uploaded,checked it was rw,r,r.But once this was done my site couldnt be viewed at all,it said there was an internal server error.I have absolutely no idea where i went wrong,any advice would be appreciated.thanx

Feyd
08-12-2002, 07:20 PM
Can you post all of the contents of your htaccess file exactly as it appears in the file?

Feyd
08-12-2002, 07:21 PM
Oh, and this should probably be in the General server side forum...

jkd
08-12-2002, 09:04 PM
Originally posted by Feyd
Oh, and this should probably be in the General server side forum...

And you said...? :)

carla
08-12-2002, 09:17 PM
ok,this is all i wrote
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?stormystar.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

Feyd
08-12-2002, 11:10 PM
Try these:



Options FollowSymLinks Includes
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http:/([a-z0-9-]+\.)*stormystar.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://your.ip.add.ress.*$ [NC]
ReWriteRule .*\.(gif|jpg)$ - [N,F,L]

Line 1 is a safety, 2 turns on mod_rewrite, 3 checks to see if referer is blank, 4 & 5 checks to see if referer is your site and 6 fails 403 invalid referers.

or redirect/protect your entire images folder:


Options FollowSymLinks Includes
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*stormystar.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://your.ip.add.ress.*$ [NC]
RewriteRule /* http://www.stormystar.com [L,R]

carla
08-13-2002, 12:34 AM
No,it just won't have it.I tried just protecting the image folder and all my images on my site came up broken.Thanx for trying to help though.

Spookster
08-13-2002, 01:38 AM
Did you put the .htaccess file in the root directory of your site or did you put it in your images directory?

carla
08-13-2002, 01:39 AM
I've tried it in both,several times,lol

Spookster
08-13-2002, 01:52 AM
Are you positive that your web host has the mod_rewrite module installed on the server?

Feyd is the htacess expert around here so until he gets back here are a few links to check out:

http://www.thesitewizard.com/archive/bandwidththeft.shtml

http://www.scriptygoddess.com/archives/000988.php

carla
08-13-2002, 01:54 AM
Thanx,i'll go and take a look,I must admit i'm starting to wonder the same thing(about the host)I emailed them to ask and they said yes but who knows!I've mailed them to say its not working but i dont know if they'll be any help.

mouse
08-13-2002, 02:43 AM
I don't think mod-rewrite not being enabled would cause an internal server error.

Feyd
08-13-2002, 02:45 AM
Hmm, that's weird...all of these work for me...

Are you sure mod_rewrite is installed and enabled?
Do any other htaccess commands work on your server?

(Oh, and your images will show up blank if you have no referer and you aren't using RewriteCond %{HTTP_REFERER} !^$ to allow for the referer not being present, as in when somebody types in your URL directly)

Did you change the ip address to your site's ip address, or leave it as it is in the example (just checking, not insinuating you are one crazy copy and paster ;) ) If you don't have a true IP address for your site, just omit that line.

Do you have any other mod_rewrite commands in your htaccess? Is there a global htaccess in your root that has mod_rewrite commands (the nearest htaccess--images--should take over from the root htaccess, but I've seen stranger things).

Feyd
08-13-2002, 02:48 AM
It can throw 500, mouse, and often does. htaccess loves to throw 500 errors around, one typo can break your entire site. If mod_rewrite is not enabled, I've seen instances of it throwing a 500 error and instances of it simply not processing and dying silently unless you are paranoid enough to check your error logs.

Speaking of error logs, Carla? Do you have access to yours and if so, is there any more information you can give us from that?

carla
08-13-2002, 11:16 AM
I didnt have an IP adress so i just omitted that line.I've checked the error logs and they say nothing,which is a bit strange because i would of thought that error would show up.This may be nothing but in my control panel there are options to password protect your site and customize the error page,could there be a conflict?I am thinking of changing hosts anyway and the new one i'm looking at has just installed mod rewrite so i might just switch my site.I have to go away for a few days now(just so you know i'm not being rude when i dont reply)but i'll check this board when i get back and i should of heard from my current host by then aswell(i emailed them about the htaccess not working).

carla
08-18-2002, 08:43 PM
I'm back,lol,and it still doesnt work.But this time i got something in the error log,it was this :-[Sun Aug 18 19:34:32 2002] [alert] [client 217.39.132.37] /usr/local/apache/domains/s/t/stormystar.com/public_html/.htaccess: Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration

does this mean anything to anyone?

carla
08-21-2002, 05:28 PM
Not to worry!I'm moving my site.You can close or delete this topic if you want.Thanx for your help anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum