Forum Moderators: phranque

Message Too Old, No Replies

301 redirect cgi script

changed directory for script, having progs with redirect

         

icarus

8:35 pm on Feb 6, 2003 (gmt 0)

10+ Year Member



Hi,

I've changed the directory name for one of my scripts and I've tried using this in .htaccess as a redirect for visitors who haven't updated their links:

redirect 301 /cgi-bin/ads/index.cgi [example.com...]

All I end up with is a 404 error. What am I doing wrong? Any advice would be greatly appreciated.

Thanks.

[edited by: DaveAtIFG at 4:02 am (utc) on Feb. 7, 2003]
[edit reason] Revised URL [/edit]

jdMorgan

8:49 pm on Feb 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



icarus,

When you get the 404 error, which file is not found - /cgi-bin/ads/index.cgi or /cgi-bin/classifieds/index.cgi?

Jim

icarus

9:51 pm on Feb 6, 2003 (gmt 0)

10+ Year Member



Hi Jim,

Thanks for your response. I get the 404 on the [example.com...]

[edited by: DaveAtIFG at 4:03 am (utc) on Feb. 7, 2003]

jdMorgan

10:00 pm on Feb 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So the redirect is not happening, the question is why.

What is the full path name to your .htaccess file?
Is it in your root directory, or in a subdirectory of root?
(I'm thinking that .htaccess is not being processed, and trying to diagnose that.)

Jim

Orange_XL

10:22 pm on Feb 6, 2003 (gmt 0)

10+ Year Member



Does your .htaccess have enough rights?

icarus

10:31 pm on Feb 6, 2003 (gmt 0)

10+ Year Member



Hi,

I have one other redirect going which is working fine.

The htacess file is stored in this directory:

/usr/home/www/user/user.com/docs/

and the cgi-bin directory is

/usr/home/www/user/user.com/cgi-bin/

as the cgi-bin directory is outside the docs directory where htaccess, is this my problem? I thought that since in

redirect 301 /cgi-bin/ads/index.cgi

part of the statement that this would be the correct syntax..

jdMorgan

10:55 pm on Feb 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



icarus,

Well, it looks like the problem is that your .htaccess containing the redirect is not in the file path to /cig-bin, and so is not being accessed.

It needs to be in /usr/home/www/user/user.com/ , /usr/home/www/user/user.com/cgi-bin/ , or /usr/home/www/user/user.com/ads/ - Your choice. And you can have multiple .htaccess files in any or all of those directories, so put the redirect wherever it makes the most sense to you from a maintenance standpoint.

Note that the path on the left side of your redirect should not include the names of directories above where it resides. So if you install the redirect in an .htaccess file in /usr/home/www/user/user.com/ads/ , then it would read:
Redirect 301 /index.cgi [example.com...]

and in /usr/home/www/user/user.com/ , it should read:
Redirect 301 /cgi-bin/ads/index.cgi [example.com...]

HTH,
Jim

[edited by: DaveAtIFG at 4:04 am (utc) on Feb. 7, 2003]

icarus

7:10 am on Feb 7, 2003 (gmt 0)

10+ Year Member



Jim,

Once again you have been the cure to all my htaccess ills. I thank you for your time.