#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    122
    Rep Power
    66

    Htaccess RewriteRule not working in cgi-bin subdirectory


    Greetings,

    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:

    Options +FollowSymLinks
    RewriteEngine on
    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?

    Thanks!
    DM

    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 02:47 AM.
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    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/.

    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??
    This part doesn't make sense, I'm guessing there's a misunderstanding there.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    122
    Rep Power
    66
    Hi E-Oreo,

    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!
    DM

    Originally Posted by E-Oreo
    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.
  6. #4
  7. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,126
    Rep Power
    9398
    Originally Posted by doctormelodious
    The problem has been resolved. The explanation is too complicated and convoluted to spell out here, but all is well now.
    Yeah, that margin is too small, isn't it?

    Comments on this post

    • salem agrees : LOL - nice one :)
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    122
    Rep Power
    66
    Originally Posted by requinix
    Yeah, that margin is too small, isn't it?
    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.

    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.

    Thanks again,
    DM
    Last edited by doctormelodious; January 27th, 2013 at 06:54 PM.

IMN logo majestic logo threadwatch logo seochat tools logo