For one of my sites, google started indexing pages like:
www.domain.com/?index.php=en-id1&itemid=3711&view=21
and they indexed several of these in just a day, making the site appear to have thousands of pages.
Other than trying to clean up the site, fixing security issues, and having google try and remove those pages from index. I want to redirect these pages to the homepage itself, so it removes the query string from the URL completely.
This is a wordpress site, so I put a rewrite condition like so, above the wordpress rewrite rules in htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^index.php*$
RewriteRule ^index\.php$ http://domain.com/%1 [R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
How can I re-direct all pages that start with /?index.php=en-id to just my homepage?