Apache : Display perl script as a text

I have Perl files with no extension (not in the format of .pl) I need to execute them when I click them not open them as a plain text.

when I add pl extension to them. they work successfully. (when I added in apache.conf

    AddHandler cgi-script .cgi  pl


but I need to know if there's a way to execute them without adding the extension


You can use SetHandler to decide what Apache treats as a cgi-script.

In apache configuration, add this and reload/restart Apache:

<Directory /path/to/directory/with/perl-files>
    SetHandler cgi-script

# Or <DirectoryMatch>, <Location>, <FilesMatch> or similar directives


In the directory itself, add file .htaccess with content:

SetHandler cgi-script

This will make Apache treat everything in the directory as a cgi-script and try to execute it regardless of file extension.

The .htaccess solution might need additional permissions in apache configuration, (like AllowOverride SetHandler) see Apache Doc for AllowOverride

Need Your Help

Android WebView Javascript communication error

javascript java android webview

I've got a problem with my WebView App. I will start a communication between WebView and App via Javascript.

Taking Image backup of Windows azure server

azure backup virtual-machine

Im using Microsoft windows azure to host my Web application. I want to take a image backup of my server.