Forum Topic: redirecting SERPs

Forum: .htaccess Forum : Redirecting • Posted by Dogsized • Updated:

I noticed the SERPs for dogsized.com are horrible. It’s one of the reasons I’m trying to change my website permalinks and purchased your book/pdf.

In the SERPs I see for example:

dogsized.com/shop/page/3/?orderby=price-desc?

dogsized.com/shop/page/2/?orderby=price?

So I put into my .htaccess:

RedirectMatch 301 ^/shop/page/ http://dogsized.com

Luckily it is redirecting to the homepage, but the URL is often left like:

http://dogsized.com/?orderby=price-desc

1 Reply to “redirecting SERPs”

Posted by Jeff Starr

Yes, that will happen with the query string unless explicitly removed, which is possible via mod_rewrite, like so:

<IfModule mod_rewrite.c>
	RewriteCond %{REQUEST_URI} ^/shop/page/(.*) [NC]
	RewriteRule .* http://dogsized.com/? [L]
</IfModule>

The trick is the question mark at the end of the RewriteRule, which instructs Apache to remove the query string after redirecting.