My Perl app reveals the filename ‘processing.cgi’ in the addressbar when running on my hosting account, but on localhost it seems to work fine, that is, it doesn’t reveal the filename ‘processing.cgi’.
Here’s .htaccess thats exactly the same on both locations:
AddHandler cgi-script .cgi
Options +ExecCGI
IndexIgnore *
DirectoryIndex processing.cgi
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ processing.cgi/$1
RewriteRule ^$ processing.cgi [L]
RewriteRule ^/$ processing.cgi [L]
This is the .htaccess in /public_html:
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.main-domain\.com$ [NC]
RewriteRule ^(.*)$ http://main-domain\.com/$1 [R=301,L]
# BEGIN WordPress
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteBase /
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.php [L]
# </IfModule>
# END WordPress
What do I need to change?
Many thanks for your help!
With current setup, if you type
http://example.com/in your browser location bar there is no possible way you can seeprocessing.cgiin such location bar unless your Perl script performs an HTTP redirection (by sending theLocationheader). So I suggest you double-check your Perl code.Whatever, I see what appear to be many directives scattered random around the file. I think it’ll be more productive if I explain what they mean:
Enable CGI scripts and map the *.cgi extension so any file that ends with
.cgiis considered a program.Instruct Apache to generate empty directory listings. When people do not want directory listings, they normally just disable them:
Options -IndexesWhen the URL points to a directory, find and display a file called
processing.cgiin such directory. Are you planning to maintain a copy of your Perl program on every directory of your site?If the URL doesn’t map to an existing file or directory…
When user types
http://example.com/foo/bar.jpgactually runhttp://example.com/processing.cgi/foo/bar.jpg. See if any other rules matches.When user types
http://example.comactually runhttp://example.com/processing.cgi. We’re done with rules.When user types
http://example.com/actually runhttp://example.com/processing.cgi. We’re done with rules.It’s clear now that you have a lot of redundant rules. Your exact needs are not 100% clear to me but I guess you can savely remove most of your directives: