|
From: Jeff D. <da...@ma...> - 2001-04-06 17:23:21
|
>i *think* the two are equivelent to apache, so it
>should just be a matter of patching phpwiki to understand the encoded
>version of "?" as a legit delimiter.
The escaping hides the special meaning of '?' as a separator
between the resource name ('index.php') and the query args ('NomicFaq').
So, the escaped version causes apache to look for a file called
'index.php?NomicFaq', which of course doesn't exist.
-----
Here's another solution: replace your old html by a CGI script which
issues the HTTP redirect. Here's one way:
1. Edit FAQ.html, so that it contains one line:
<?php header("Location: /~nomicwiki/index.php?NomicFaq"); ?>
(You need to include 'http://www.nomic.net' only if you're redirecting
to a different HTTP server.)
2. Now you need to convince apache that FAQ.html is really a PHP script.
One way (assuming apache is configured to allow it) is to place the
following three lines in the '.htaccess' file in the same directory
as 'FAQ.html':
<Files FAQ.html>
SetHandler application/x-httpd-php
</Files>
(If you're running PHP3, you might have to change to middle line to:
'SetHandler application/x-httpd-php3'.)
I thought initially, this would have the same problem as your
RedirectMatch solution (I thought apache would escape the '?' before
sending it out) --- but I've just tried it, and it works, at least on
my system.
Jeff
PS. If you wanted to get fancy, or if you had a lot of files that have
moved, I think you can do basically the same thing by writing a "404
error handler" script. You use something like:
ErrorDocument 404 /error404.php
either in httpd.conf or .htaccess to get your script ('error404.php') run
whenever someone requests a non-existent file.
The requested URL is available to the script in the variable $REDIRECT_URL.
The script can then figure out the new URL (either systematically, or by
lookup table) and issue the redirect. Or if no suitable redirect is found,
it can produce an error message.
|