WordPress.org

Ready to get started?Download WordPress

Forums

Stripping all queries using .htaccess (1 post)

  1. morpheus83
    Member
    Posted 1 year ago #

    I recently moved my blog from Movable Type to WordPress. My permalink structure is -
    http://www.mywebsite.com/category_name/entryname.php

    Movable Type paginated by adding a query to the index page. For eg - http://www.mywebsite.com/apple/index.php?page=3 where as WordPress paginates http://www.mywebsite.com/apple/3 but what has happened is Google has cached my previous pagination and keeps on crawling the url's by mixing the parameters. So the Googlebot would crawl - http://www.mywebsite.com/apple/3?page=3 as well. My website has a large number of posts so this adds to a lot of unnecessary pages being crawled.

    I would want to strip all incoming queries and redirect the user to the page without the query using .htaccess.

    This is my current .htaccess
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    </IfModule>

    What rules should I add a 301 to any and all queries and direct the user to the page without the query.

Topic Closed

This topic has been closed to new replies.

About this Topic