Link to home
Start Free TrialLog in
Avatar of webstuck5
webstuck5

asked on

Redirect Query String URLs for SEO

I have a SEO related question. In Google Webmaster Tools - HTML Improvements, I have some duplicate title issues. Here are the listed problems:

Love Astrology: A guide to romance and love through astrology.
/astrology/love-astrology.htm
/astrology/love-astrology.htm?ref=s0d.org

10 Romantic Ideas for Music Lovers
/top-10/romantic-ideas-for-music-lovers.htm
/top-10/romantic-ideas-for-music-lovers.htm?asid=33f97801

Romantic Ideas for Long Distance Relationships
/dating/long-distance-relationships.htm
/dating/long-distance-relationships.htm?iframe=true&width=100%25&height=100%25

I Love You
/i-love-you.htm
/i-love-you.htm?iframe=true&width=100%&height=100%

These issues seem to be related to query strings that we don't use. I am wondering how best to deal with these issues. Should I set up .htaccess redirects for each of the query strings: ref, asid, and iframe? It seems like it would be better if I could somehow tell the server to just not redirect query strings that I set up to use and redirect all others. Is there a way to do this?
Avatar of Gregg
Gregg
Flag of United States of America image

Id suggest using a rewrite condition to detect the query string values and redirect (permanently) to the correct page.

Take a look at SO post for example.

I hope this helps.
Avatar of webstuck5
webstuck5

ASKER

Is there a way to just say redirect all query strings except for whichever ones I may be using?
Google Webmaster Tools has a section where you can tell them to ignore certain parameters:

Configuration->URL Parameters
Maybe this is what you're searching for. This deletes the query string off the page.

This code goes in your .htaccess file in your root directory:

RewriteEngine On
RewriteRule ^page\.php$ /page.php? [L]

Open in new window

I'd rather not do it within Google Webmaster Tools because that doesn't do anything for the other search engines. I also don't like the idea of just deleting the query string because I may want to use a query string at some point. Is there no way to just redirect all query strings except for ones I specify?
Do those parameters have a use? If so you will break things if you redirect. If not, redirecting will work for you.

If you use Analytics campaign tracking or AdWords then be very careful about what parameters cause redirects and that you don't remove other parameters in the process. Otherwise you will break the tracking code those systems use.

Another solution is to implement the canonical tag on those pages. This lets you specify the exact URL you want to be indexed (e.g. without the parameters). You don't need to do redirects and run the risk of breaking other things.
How would I implement canonical tags on just the pages with query strings?
You can place the canonical tag on all pages. How you do it is down to how your website is built.
There are no actual page files with query strings so how would I put a canonical tag on those pages.
The query string does not change the page requested unless you are using the query string to create dynamic content. so these are the same page

/top-10/romantic-ideas-for-music-lovers.htm
/top-10/romantic-ideas-for-music-lovers.htm?asid=33f97801

Adding a canonical tag to the first should also add it to the second.
I want the none query string URL indexed. Are you saying that I should have a canonical tag on /top-10/romantic-ideas-for-music-lovers.htm pointing to itself?
That's fine. Not necessary but not an issue either.

It can actually help out in other duplicate issues like https URLs or different case URLs
The problem is that Google seems to see a URL without a query string and the same URL with a query string as having duplicate titles. So, I'm not really sure how to fix it. It seems odd for me to put a canonical tag on a url to point to itself to handle the url if a query string is added to it.
ASKER CERTIFIED SOLUTION
Avatar of Tony McCreath
Tony McCreath
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial