January 26th, 2013, 03:39 AM
Htaccess RewriteRule not working in cgi-bin subdirectory
I've got RewriteRules in the .htaccess file of my html directory, and they all work perfectly. But the ones in the .htaccess file in a subdirectory of my cgi-bin directory (cgi-bin/orders) will not work at all. Here's how that .htaccess file looks:
RewriteRule ^m.login.cgi$ https://blahblah.com/blah.cgi [R]
So when I type http://mydomain.com/cgi-bin/orders/m.login.cgi it's not getting redirected. I have lines that are almost exactly like this in the .htaccess file in my html directory, and they work. What am I missing?
EDIT: Even weirder: the redirects DO work from my Mac -- but not from my associate's Mac (running a different version of OS X) and not from my iPhone! Same exact URLs typed in, but on one computer they redirect, and on the other two devices they don't. Huh??
Last edited by doctormelodious; January 26th, 2013 at 03:47 AM.
January 26th, 2013, 08:09 PM
Is the .htaccess file being processed at all? If you put junk into it do you get a 500 error? AllowOverride might be turned off for /cgi-bin/.
This part doesn't make sense, I'm guessing there's a misunderstanding there.
January 26th, 2013, 11:52 PM
The problem has been resolved. The explanation is too complicated and convoluted to spell out here, but all is well now.
Thanks for the reply!
Originally Posted by E-Oreo
January 27th, 2013, 02:23 AM
Yeah, that margin is too small, isn't it?
Originally Posted by doctormelodious
Comments on this post
January 27th, 2013, 10:32 AM
Touché. Short version: I was about to move our domain to a different host, and wanted to go ahead and redirect to the new server before the 24-hour+ propagation period began. I had redirects in the public_html folder that would redirect http://mydomain.com/oneWordShortcut to http://xxx.xxx.xxx.xxx/cgi-bin/subfolder/foo.cgi (where xxx.xxx.xxx.xxx is the IP of our new server). BUT some of the links I was testing pointed to http://mydomian.com/cgi-bin/subfolder/foo.cgi, for which I had not created a redirect in subfolder's .htaccess. Also there were problems with cookies, because the paths were not consistent. This made some of the pages appear (to me) to not be redirecting, even though they were. Whole 'nother wild goose chase to figure that one out.
Originally Posted by requinix
Shorter version: Operator Error -- but I still have no idea why I was getting different results on different devices using the exact same links. Maybe something to do with caches? Or the way the browsers parsed the URL??
The propagation window has passed now, and the domain is moved. And I'm now a tiny bit more educated in the esoteric art of redirects.
Last edited by doctormelodious; January 27th, 2013 at 07:54 PM.