Forum Moderators: phranque
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]
Thanks for your response. I get the 404 on the [example.com...]
[edited by: DaveAtIFG at 4:03 am (utc) on Feb. 7, 2003]
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..
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]