[thelist] Trouble with .htaccess Redirects and a Tip

Means, Eric D eric.d.means at boeing.com
Wed Apr 17 10:57:00 CDT 2002


Have you tried
Redirect permanent /olddirectory http://myDomain.com/newdirectory/
?

How about
Redirect permanent /olddirectory/ http://myDomain.com/newdirectory/
?

The latter one should work because when Apache sees that the file requested
is a directory, it will issue a redirect to the same URL with a trailing
slash.  You could also try putting both in there, with the second one first
in the htaccess file.

-----Original Message-----
From: Bob Haroche [mailto:bharoche at usa.net]
Sent: Wednesday, April 17, 2002 10:51 AM
To: thelist at lists.evolt.org
Subject: [thelist] Trouble with .htaccess Redirects and a Tip


Hello all,

I've done a substantial re-organization of a site and am trying to implement
the Redirect permanent directive with .htaccess to prevent 404's. Everything
works fine for individual files but for entire directories, I'm having
trouble.  Here's my syntax:

Redirect permanent /olddirectory http://myDomain.com/newdirectory/

This works fine IF someone types in http://myDomain.com/oldirectory

BUT if someone types in http://myDomain.com/oldirectory/
(note the trailing slash), they wind up at:

http://myDomain.com/newdirectory//

which, because of the double trailing slashes, results in a 404.

I think I need some sort of regexp pattern or mode re-write directive, but
could use direction on this.  Thanks!

-------------

<tip type="troubleshooting mail cgi scripts">

If you keep getting unexplained server errors when installing cgi scripts
that generate email, check to see whether the email address you're sending
to *actually exists*. If it doesn't, instead of a bounced mail message you
might simply receive a Server 500 error -- which in this case has nothing to
do with your script but simply with the non-existence of the destination
email.

</tip>

-- only took me two hours last week to figure that one out!




--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list