Support » How-To and Troubleshooting » redirecting old query-string requests

redirecting old query-string requests

  • I switched to permalinks (finally) after several months running on the query-string. Everything works fine, but the search engines now have my site double-indexed… all my permalinks and all my querystring URLs…

    I want to intercept any request that has a querystring containing ‘p’ or ‘page_id’ parameters and serve up a 404 header (probably by 301-ing to ?error=404) – but only to the search engines…

Viewing 4 replies - 1 through 4 (of 4 total)
  • I think I sorted it out… so far, this has the intended results:

    RewriteCond %{HTTP_USER_AGENT} (msnbot|slurp|Googlebot|gigablast) [NC]
    RewriteCond %{QUERY_STRING} (p=[0-9]+|page_id=[0-9]+) [NC]
    RewriteRule ^.*$ /index.php?error=404 [R=301,L]

    well, that’ll work fine — if you don’t mind killing your pagerank. 404s will nuke the original pages and their pagerank, whereas a 301 to the new permalinks could be done and retain pagerank for all existing pages.

    if you don’t have real pagerank, or don’t care, yeah the 404 is a dirty-hack substitute. 😉


    I’m more worried about dupe-content than pagerank at this point, but thanks for the heads-up…

    I’m not actually sure what the clean way would be…

    I can’t 301 to the appropriate post/page because the querystring is by ID and my permalinks are by postname…

    also, the SE’s already have all the permalink versions indexed, so I really just need to clean out the old pages that still work but I don’t want them indexed…

    for everyone else’s benefit, it just occured to me that it’s probably better not to 301 to the error page, just rewrite – if an SE gets a 301 to a 404, it might just ignore the 301 not un-index the orig. page…
    So the last line would then be:
    RewriteRule ^.*$ /index.php?error=404 [L]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘redirecting old query-string requests’ is closed to new replies.
Skip to toolbar