Forum Moderators: phranque

Message Too Old, No Replies

URL Rewriting question - redirecting then rewriting to preserve index

         

yann1806

7:19 pm on Jun 10, 2006 (gmt 0)

10+ Year Member



Hi all,

I have a site with a list or dynamic URLs, already indexed in Google, they look like "articleview.php?id=1", etc; of course I have an "articleview.php" php script.

I want to rewrite them in to static urls like "articleview-1.htm", and redirect the dynamic URLs to the static ones, so that their indexing is not lost for Google.

I set up those two Apache rewrite rules:

RewriteRule articleview\.php?id=(.*)$ articleview-$1.htm [R=301,N]

RewriteRule articleview-(.*)\.htm$ articleview.php?id=$1

I would expect this to redirect articleview.php?id=1 to articleview-1.htm, then start over (the "N" flag), and rewrite articleview-1.htm to articleview.php?id=1 -- this way the new URL is articleview-1.htm, and Google is made aware of it when trying to fetch the one one, and the proper page displays.

My problem is: the proper page is indeed displayed when I get articleview.php?id=1, but the URL stays at it was at first, i.e. it's not redirected to articleview-1.htm.

Thanks to anyone who would have somewhere to point me to, I've tried a few things, but nothing worked so far...

jdMorgan

10:53 pm on Jun 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See this article [webmasterworld.com] in our forum library. Your issue is specifically addressed.

Jim

yann1806

12:56 am on Jun 11, 2006 (gmt 0)

10+ Year Member



Thanks a lot, Jim, right on.

Yann