Question

Google in error has indexed thousands of urls that are not in the sitemap.xml. These urls probably are considered as duplicate content (according to Google only).

I would need to deindex them fairly quickly. So would a 410 gone status would be handy.

in htaccess i would like to redirect

www.domain.com/page.php?bid=1&page=xxx
www.domain.com/page.php?bid=2&page=xxx
www.domain.com/page.php?bid=3&page=xxx
www.domain.com/page.php?bid=5&page=xxx
www.domain.com/page.php?bid=6&page=xxx
www.domain.com/page.php?bid=7&page=xxx
www.domain.com/page.php?bid=8&page=xxx
www.domain.com/page.php?bid=9&page=xxx

to this page

www.domain.com/page.php?bid=4&page=xxx

Was it helpful?

Solution

Place this code in your root .htaccess:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^bid=[1-35-9]&page=([^&]+) [NC]
RewriteRule ^([^.]+\.php)$ /$1?bid=4&page=%1 [L,R=301]

301 (permanent redirect) will force Google to update its cached results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top