Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Apache I would like a URL "/myscript" or "/myscript?param=myparam" to execute a CGI script located at:


I have tried:

Action custom-action /usr/local/scripts/
<Location "/myscript">
    SetHandler custom-action

but this isn't working.

Any ideas how I can achieve the mapping of URL to script?

share|improve this question

mod_rewrite can easily do that with

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/myscript$
RewriteRules (.*) /usr/local/scripts/

Be sure to set permissions appropriately, both the actual file permissions and a Directory Directive to allow access to that folder.

Example Directory Directive:

<Directory "/usr/local/scripts">
    Allow from All
    AllowOverride None
    Options None +ExecCGI
share|improve this answer

Your handler will work if you create a file or directory in DOCUMENT_ROOT called myscript. Haven't worked out why yet, but it works!

[edit] Seems that if you're using Action to define the handler then you're effectively creating a filter through which the files in the filesystem will be passed (e.g. for DIY server-side include processing). If the target doesn't exist in the filesystem then there's nothing to pass to your script (through PATH_TRANSLATED) so the server throws an error.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.