Forum Moderators: phranque

Message Too Old, No Replies

mod rewriting and 301 redirects

         

Langers

12:06 pm on Aug 22, 2005 (gmt 0)

10+ Year Member



Hi have recently implemented mod rewriting on my site to generate SEF links. This means that a link that was, for example:

index.php?category=21

now appears as:

pg-index-cat-21-d-keyword

which is all good and Google et al includes it in their indexes.

However, since index.php?category=21 was the originally indexed page and it is still a valid page on the site it cannot be removed from Google (must be 404), resulting in duplicated pages.

So, can I get over this by specifying in my .htaccess file to do a 301 redirect on all non-SEF links to SEF links? If so, how?

Here is what I have in my .htaccess atm:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^pg\-([^/\-]+)\-([^/\.]+)\.html$ /$1.php?workstring=$2 [L]
RewriteRule ^pg\-([^/\-]+)\.html$ /$1.php [L]
</IfModule>