Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: .htaccess

  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry .htaccess

    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

  • #2
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you post all of the contents of your htaccess file exactly as it appears in the file?
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #3
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, and this should probably be in the General server side forum...
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by Feyd
    Oh, and this should probably be in the General server side forum...
    And you said...?

  • #5
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok,this is all i wrote
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?stormystar.com/.*$ [NC]
    RewriteRule \.(gif|jpg)$ - [F]

  • #6
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try these:

    Code:
    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:
    Code:
    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]
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #7
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    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.

  • #8
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Did you put the .htaccess file in the root directory of your site or did you put it in your images directory?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #9
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've tried it in both,several times,lol

  • #10
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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...dththeft.shtml

    http://www.scriptygoddess.com/archives/000988.php
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #11
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Location
    North East England
    Posts
    853
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think mod-rewrite not being enabled would cause an internal server error.
    [+] Computer/PC issues [+] Silverpaw3D
    ------------------------------------------------
    Never buy a dwarf with learning disabilities...

    ...it's not big, and it's not clever.

  • #13
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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).
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #14
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #15
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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).


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •