# Pre 404

**URL:** <https://www.ruby-forum.com/t/pre-404/90294>\
**Category:** Radiant CMS\
**Created:** [March 27, 2007, 2:25pm UTC](https://www.ruby-forum.com/t/pre-404/90294 "2007-03-27T14:25:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [March 27, 2007, 2:25pm UTC](https://www.ruby-forum.com/t/pre-404/90294/1 "2007-03-27T14:25:13Z")

</div>

Hi,

I wasn’t sure what to call this post - here goes…

I’m migrating from an existing site catalog to Radiant based site. The  
site is  
indexed in various search engines already, so after deploying the new  
Radiant  
based site, it is very likely a search engine result will produce a link  
to an  
old site URL. I’d like to devise a way to accommodate the old URL in  
the new  
site.

This is what I’m thinking: reviewing the site logs I’ve created a table  
of old  
url and new Radiant url. Now, I need to write some code that checks the  
url  
for a reference in the aforementioned table _before_ returning a 404.  
My  
assumption is that the old url will not be found in Radiant based site,  
so the  
FileNotFoundPage will be called. (I want to check the URL before  
processing  
FileNotFoundPage and if found in the table, redirect to the new URL, of  
course).

So, where is the best place to integrate this code into Mental?

app/models/FileNotFoundPage and override render method?

I see in Page:  
children.find(:first, :conditions =\> “class\_name = ‘FileNotFoundPage’”)

So, I guess the FileNotFoundPage is hardcoded.

Could I write an extension to drop in a custom FileNotFoundPage?

Your thoughts appreciated,

Todd

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [March 27, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/pre-404/90294/2 "2007-03-27T14:33:14Z")

</div>

Hi Todd:

Todd McGrath wrote:

> So, where is the best place to integrate this code into Mental?

Why don’t you use normal HTTP redirects with status code 301. You can  
easily set those up with mod\_rewrite in Apache and it even allows you to  
have an external program to generate the redirect URLs. Lighttpd might  
be able to do similar. That way also the search engines will be notified  
of the change of URL and can link their entries for both URLs together.

Cheers,  
Oliver

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [March 27, 2007, 4:18pm UTC](https://www.ruby-forum.com/t/pre-404/90294/3 "2007-03-27T16:18:35Z")

</div>

Thanks Erik and Oliver

Quoting Erik van Oosten [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [March 27, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/pre-404/90294/4 "2007-03-27T14:38:15Z")

</div>

Todd,

There was a thread on this subject a couple of weeks ago.  
[http://www.nabble.com/forum/ViewPost.jtp?post=9445634&framed=y](http://www.nabble.com/forum/ViewPost.jtp?post=9445634&framed=y)

Regards,  
Erik.

Todd McGrath schreef:

> This is what I’m thinking: reviewing the site logs I’ve created a table of old
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Erik van Oosten

> **[Day to day stuff](http://day-to-day-stuff.blogspot.com/)**
>
> Experiences from a hard core JVM programmer. Likes to keep things simple.
