Redirect FROM cgi-bin to home page

.htaccesscgi-binredirect

We are currently building on a domain that was previously used by someone else. We have managed to 301 redirect everything except for one page:

http://www.mysite.com/cgi-bin/link.cgi

I have tried redirecting everything from the cgi-bin directory using htaccess in addition to putting the htaccess in the cgi-bin directory (which is outside of the httpdocs directory) to no avail. Currently running on media temple server. Is there a permission I need to set to access that folder with the htaccess? Use something else? I don't want to use any cgi, just get it back to my home page.

Thanks in advance!

Best Answer

If you have access to the config for your virtual host:

Redirect 301 /cgi-bin/link.cgi http://www.mysite.com

If you don't have access to the configuration for your virtual host, then you're probably out of luck since your web server config is likely to contain something like this:

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    ...
</Directory>

...which means that .htaccess files will be ignored in the cgi-bin directory...

As a last resort, you might try stuffing the following into link.cgi:

#!/usr/bin/perl

print "Location: http://www.mysite.com\n\n";
Related Topic