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=s0 d.org
10 Romantic Ideas for Music Lovers
/top-10/romantic-ideas-for -music-lov ers.htm
/top-10/romantic-ideas-for -music-lov ers.htm?as id=33f9780 1
Romantic Ideas for Long Distance Relationships
/dating/long-distance-rela tionships. htm
/dating/long-distance-rela tionships. htm?iframe =true&widt h=100%25&h eight=100% 25
I Love You
/i-love-you.htm
/i-love-you.htm?iframe=tru e&width=10 0%&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?
Love Astrology: A guide to romance and love through astrology.
/astrology/love-astrology.
/astrology/love-astrology.
10 Romantic Ideas for Music Lovers
/top-10/romantic-ideas-for
/top-10/romantic-ideas-for
Romantic Ideas for Long Distance Relationships
/dating/long-distance-rela
/dating/long-distance-rela
I Love You
/i-love-you.htm
/i-love-you.htm?iframe=tru
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?
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
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:
This code goes in your .htaccess file in your root directory:
RewriteEngine On
RewriteRule ^page\.php$ /page.php? [L]
ASKER
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.
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.
ASKER
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.
ASKER
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-lov ers.htm
/top-10/romantic-ideas-for -music-lov ers.htm?as id=33f9780 1
Adding a canonical tag to the first should also add it to the second.
/top-10/romantic-ideas-for
/top-10/romantic-ideas-for
Adding a canonical tag to the first should also add it to the second.
ASKER
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-lov ers.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
It can actually help out in other duplicate issues like https URLs or different case URLs
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Take a look at SO post for example.
I hope this helps.