0
votes

I've been using this code to 301 redirect WP pages like this one: mysite.co.uk/?page_id=12983 to: mysite.co.uk/nicepagetitle/

RewriteCond %{QUERY_STRING} !^page_id=$ RewriteRule .* http://mysite.co.uk%{REQUEST_URI}? [R=301,L]

I'm not sure if this is correct and what's more Google is still showing these pages: mysite.co.uk/?page_id=xxx in my Webmaster tools under HTML suggestions.

I will appreciate if you help me with this issue.

1
Not sure I understand what your question is. Does it work, or does it not? Also, have you changed the links inside the blog accordingly? - Pekka
Yes, I have changed the links and WP rewrites them - the browser shows just these URLs: mysite.co.uk/nicepagetitle/, no problem here. I'm afraid that the code above is wrong and does not redirect 301 the ?page_id=xxx URLs correctly in order to tell the search engines that these URLs have been moved permanently (if Google can still find them - something must be wrong). So my question basically is if the above code is correct and if not - than how to redirect these URLs? - Zmey

1 Answers

0
votes

Use the firefox plugin Live Headers to check the return codes given by your server and the redirected URLs. It will tell you if the redirect is correctly set to 301. To debug htaccess rules, you'll have to access logs on your apache server that may or may not be easy for you to look at.

For the Webmaster tools problem, It could be that, or google has a cached version... welcome to the web!

If you wish to do this without using htaccess, canonical tags which are supported by google et. al. would also serve the same purpose of putting all the link juice to the prettier URL.