--- Monty <[EMAIL PROTECTED]> wrote:
> Right now the pages on my site use this form of URL:
> 
>     domain.com/articles.php?id=999
> 
> Now that I have upgraded my server to Apache 2, I'm going to use
> the ForceType and FollowSymLinks options to change the entire site
> to use this search-engine-friendly form of URL to access all pages:
> 
>     domain.com/articles/999
> 
> But I don't want the old links to be broken once I change the site
> to this new type of URL.

Rather than rewriting URLs like you're attempting, I think you might find
it easier to just use a 404 handler to decide what the best URL is for the
user. This is a good idea in general anyway, since it can help more than
just old URLs, but also typos and the like.

You mention ForceType, so I can assume you're using Apache. Try this in
your httpd.conf or in a .htaccess file:

ErrorDocument 404 /404.php

Then, in /404.php, use $_SERVER['REDIRECT_URL'] to determine where you
should send the user. You can use:

header('Location: http://domain.com/articles/999');

In addition, you can send your own response status code that indicates
that this is a permanent redirect, not a temporary one.

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
     Coming mid-2004
HTTP Developer's Handbook
     http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to