WordPress blocking/preventing viewing of .cgi file in subdirectory

I have a .cgi file, /data/displayQuery.cgi, that WordPress is showing a generic “Page not found!” error page for. I have my .htaccess file configured to not rewrite any file in the /data subdirectory. I’ve included my .htaccess code below (the .htaccess file is in the root directory of my WordPress installation):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/(data|data/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

I created two test files, with a .php and .html file extension, that I can access just fine with no “Page not found!” error, and the contents of the file can be seen just fine with the above .htaccess file.

I tried using an iframe to display the CGI file in either a PHP or HTML file, but the iframe becomes the “Page not found!” error.

Entering the URL for a file in the /data directory that does not exist brings up a 404 error page from my hosting provider, NOT from WordPress. WordPress is blocking my .cgi file for some reason; how can I use .htaccess to unblock this file, or possibly use a WordPress function to add a exception for this file?

Solutions Collecting From Web of "WordPress blocking/preventing viewing of .cgi file in subdirectory"