Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 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";
share|improve this answer
    
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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.