I'm trying to configure a hosted Apache server, via .htaccess, to execute files with .asp extension with PHP. But I don't know what the correct handler-name for AddHandler is.

The reason is that we have a flash app that is GET requesting .asp files. We will re-write the .asp files in PHP but we can not change the flash app (we don't even have the source code).

I have tried to use the AddHandler and AddType directives.

AddHandler php-fcgid .php .asp
AddType application/x-httpd-php .asp
AddHandler application/x-httpd-php7 .asp

Examples of directives I have tried to no avail

Most give No input file specified. or set the mime-type to application/x-httpd-php for .php files (technically setting the Content-Type HTTP header).

Now, I fully understand AddHandler and AddType - the best resource I have found is https://www.webmasterworld.com/apache/4557229.htm#msg4557505.

The host has, what looks like a custom dash-board for administrating the server. I can change PHP version, from 5.4 to 7.0 and change some settings in php.ini.

I uploaded a phpinfo(); and some of the values I think is relevant is posted below. The Apache version is unknown as it just report Server: Apache. But I'm sure it is at least Apache2, since Apache 2.0 Handler is listed under SAPI Modules.

How can I figure out what the correct handler-name for AddHandler is?

PHP Version 7.0.9

Server API  CGI/FastCGI
Configuration File (php.ini) Path   /compile/php70/dest/lib
Loaded Configuration File   /etc/custom_php_config/slavespillet.dk/php.ini
Scan this dir for additional .ini files     (none)
Additional .ini files parsed    (none)
PHP API     20151012


Directive   Local Value Master Value
cgi.check_shebang_line  1   1
cgi.discard_path    0   0
cgi.fix_pathinfo    1   1
cgi.force_redirect  1   1
cgi.nph 0   0
cgi.redirect_status_env no value    no value
cgi.rfc2616_headers 0   0
fastcgi.logging 1   1


PHP Version     7.0.9

1 Answer 1


A workaround/alternative is to simply rewrite the .asp request to .php and store your files as ordinary .php files - assuming .php files are served correctly. Using mod_rewrite you could do something like the following in your root .htaccess file:

RewriteEngine On
RewriteRule ^(.+)\.asp$ $1.php [L]

This would internally rewrite a request for /path/to/something.asp to /path/to/something.php.

  • I was thinking along the same lines and implemented a re-write instead, since guessing the Action action-type name on a host seems feeble. I updated my RewriteRule with yours though as it is simpler. Thanks. Gonna leave the question unanswered for some hours, just in case someone comes up with the answer. Oct 4, 2016 at 9:49
  • Using this method you could be selective about which files you rewrite... perhaps just those in a certain directory/URL-path (you could use another .htaccess file in the subdirectory just for that purpose) or even just the specific file(s). This is arguably preferable to implementing a handler to push all .asp files through PHP, when that might not be necessary.
    – MrWhite
    Oct 4, 2016 at 11:06
  • Well, couldn't I also do that with the <Directory path>AddHandler php-fcgid .php .asp</Directory> directive? Oct 4, 2016 at 15:06
  • Yes - kind of. You could use the appropriate AddHandler/AddType directive in the .htaccess file in that directory. The <Directory> directive is only permitted in your server config / VirtualHost.
    – MrWhite
    Oct 4, 2016 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .