View Full Version : Redirecting and deleting old pages

10-31-2007, 10:49 AM
I'm in the process of redesigning the structure of my web pages. Now most of the different pages are hard coded and have URLs like http://domain.com/articles/interestingarticle.php, http://domain.com/articles/evenmoreinterestingarticle.php and so on.

With my new and improved system I use a database and the URLs appears like this: http://domain.com/articles/show?id=1

This means that all my pages will have new URLs, and I need to redirect the old pages to the new URLs. I realize that I can use a Java Script such as:

<meta http-equiv="Refresh" content="0; url="myurl.php">

but that means I have to keep all the old pages on the server.

Anyway, my question is: is there a way I can set up a redirect more simple, and that allows me to remove the old pages from the server?


10-31-2007, 02:25 PM
Maybe using .htaccess? I'm not an expert with htaccess, but look into that.

See the part here on redirect:

More info ... tutorial ...

10-31-2007, 05:14 PM
Use htaccess to set your own 404 page (a PHP one). Then in the 404 page attempt to find the page that the user intended to find. If you do find it, use header() (http://php.net/header) to forward the user to the new page (using HTTP code 301 or 302). Otherwise display an informational page stating that the resource is no longer available.