htaccess Code Doesn't Work

Discussion in 'General Programming Chat' started by The Scarlet Pimp, May 2, 2009.

  1. The Scarlet Pimp

    The Scarlet Pimp Senior Member

    Joined:
    Apr 2, 2008
    Messages:
    972
    Likes Received:
    3,446
    Occupation:
    Chair moistener.
    Location:
    Cyberspace
    I'm trying to make my .pl and .cgi scripts display as tho they were text files,
    rather than executing. This is the code I'm using but it doesn't work. :confused:

    Code:
    RemoveType .cgi .pl
    RemoveHandler .cgi .pl
    AddType text/plain .cgi .pl
    AddHandler text/plain .cgi .pl
    
     
  2. crashed

    crashed Senior Member

    Joined:
    Aug 13, 2008
    Messages:
    958
    Likes Received:
    1,201
    Occupation:
    Guru-slayer
    Location:
    Behind the VPN...
    Try removing the four lines you have and just using the following

    Code:
     
    <FilesMatch "\.(cgi|pl)$">
    ForceType text/plain
    SetHandler text/plain
    </FilesMatch>
    
    ForceType isn't supported by all hosts, which is why we back it up with a SetHandler. The FilesMatch applies this to files only with extensions .cgi or .pl
     
    • Thanks Thanks x 1