Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble redirecting urls that include cgi-bin in the path


redirect 301 /cgi-bin/pc.storefront/en/product/product.aspx?iid=123

With that redirect the server returns: /cgi-bin/pc.storefront/en/product/product.aspx does not exist on this server error messaging.

However, if keeping everything the same and removing cgi-bin from the equation then the redirect works perfectly.

The server is apache2 using mod_rewrite. cgi is also disabled in httpd.conf. Are the any concerns related to redirecting cgi-bin?

share|improve this question
Would RedirectMatch be a better declaration to use? – Tim Dec 22 '11 at 18:00
Look in the main server config for the cgi-bin alias/directive. I bet there is something there stomping/overriding your rewrite. – Tim Dec 22 '11 at 18:03
Mine has AllowOverride none and Options none. AllowOverride none means my .htaccess is completely ignored. – Tim Dec 22 '11 at 18:05
@Tim: Grep on httpd.conf returned: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased <Directory "/var/www/cgi-bin"> – JMC Dec 22 '11 at 18:05
It looks like there is a script alias for /var/www/cgi-bin/ and a directory. going to try commenting those lines – JMC Dec 22 '11 at 18:07
up vote 2 down vote accepted

There is usually a default set of directives that come "out of the box" for more Apache configurations. This default often includes a AllowOverride none directive on the cgi-bin folder/alias. AllowOverride none means .htaccess files in the folder/alias will be ignored.

Try updating the main config directive to AllowOverride Fileinfo

share|improve this answer
Commenting out the directory and script alias worked. I'm not running anything in cgi-bin, just using the server for a php/mysql app. Is there any concern in commenting out the alias and directory? – JMC Dec 22 '11 at 18:17
Only concern is if you needed cgi-bin, commenting the whole directive opposed to just changing the AllowOverride disables the cgi-bin folder completely. Sounds fine for your case though. – Tim Dec 22 '11 at 18:37

Your Answer


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.