Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

,htaccess DirectoryIndex

Status
Not open for further replies.

shezam

Programmer
Jan 30, 2009
11
IE
I have a test webserver with a directory test for example -
Im using the .htaccess file and setting "DirectoryIndex om.cgi". om.cgi is a perl script which just returns
a 404 Not found;

#!/usr/bin/perl

#Read request headers
$user_agent = $ENV{"HTTP_USER_AGENT"};
$accept = $ENV{"HTTP_ACCEPT"};
$accept_language = $ENV{"HTTP_ACCEPT_LANGUAGE"};
$content_disposition = $ENV{"HTTP_CONTENT_DISPOSITION"};
$content_type = $ENV{"HTTP_CONTENT_TYPE"};
$content_length = $ENV{"HTTP_CONTENT_LENGTH"};
$referer = $ENV{"HTTP_REFERER"};
%cookie = $ENV{"HTTP_COOKIE"};
$method = $ENV{"REQUEST_METHOD"};

#Check user agent is sent
if ($user_agent)
{
print "Status: 404 Not Found\n";
print "Content-type: text/html\n\n";
print "<html><body> No user agent in request</body></html>\n";
}


So when i make a request to I should get back a 404 and No user agent in request but the cgi script doesn't seem to be working, the code of the cgi script is being displayed on the page. Anyone any ideas
 
eek found the answer, need the following in my .htaccess file;

AddHandler cgi-script .cgi

Options +ExecCGI


Can I remove this thread and if so how?
 
No need, it may be helpful to someone else.

Scott Prelewicz
Web Developer
COMAND Solutions
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top