Forum Topic: redirecting SERPs

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

I noticed the SERPs for 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:

So I put into my .htaccess:

RedirectMatch 301 ^/shop/page/

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

1 Reply to “redirecting SERPs”

Jeff Starr
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 .* [L]

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