1

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!

Jon
  • 11
  • 2

2 Answers2

2

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";
Lasse
  • 416
  • 3
  • 6
  • thank you for your response. I created the link.cgi and have the header redirect to the home page although my browsers do not even recognize that the link.cgi is in the folder (i put one in the cgi-bin/ in the root as well as created a directory named cgi-bin in the httpdocs) i tried using the above code so that is the only thing in the cgi file right now. Is that enough to make up a cgi file? Thank you again – Jon Jan 25 '11 at 20:43
0

Why not just modify the actual CGI file to redirect, either with HTML meta tags or otherwise?

BenGC
  • 1,775
  • 15
  • 26