URL rewriting causing problems
-
Hi
I am having problems with my URL rewriting to create seo friendly / user friendly URL's. I hope you follow me as I try to explain what is happening...
Since the creation of my rewrite rule I am getting lots of errors in my SEOMOZ report and Google WMT reports due to duplicate content, titles, description etc
For example for a product detail, it takes the page and instead of a URL parameter it creates a user friendly url of
mydomain.com/games-playstation-vita-psp/B0054QAS
However in the google index there is also the following friendly URL which is the same page - which I would like to remove
domain.com/games-playstation-vita/B0054QAS
The key to the rewrite on the above URLs is the /B0054QAS appended at the end - this tells the script which product to load, the details preceeding this could be in effect rubbish
i.e. domain.com/a-load-of-rubbish/B0054QAS and it would still bring back the same page as above.
What is the best way of resolving the duplicate URLs that are currently in the google index which is causing problems
The same issue is causing a quite serious a 5XX error on one of the generated URLs
http://www.mydomain.com/retailersname/1 -
, if I click on the link the link does work - it takes you to the retailers site, but again it is the number appended at the end that is the key - the retailersname is just there for user friendly search reasons
How can I block this or remove it from the results?
Hope you are still with me and can shed some light on these issues please.
Many Thanks
-
You can write canonical tags dynamically, but you need to canonical to the product specific page. Obviously, don't canonical every details.php page down to one. It could look something like this:
$prodDesc = "games-playstation-vita";
$prodCode = "B0054QAS";
$prodURL = "http://www.mydomain.com/".prodDesc."/".prodCode;
?>
I assume that the product description and code are generated from a database, so they should be available somehow to the header.
-
This is really tough to tell from generic examples, because the first thing you need to get at is the root of why these different URLs are being crawled in the first place. If "B0054QAS" is a unique product, why is it reachable by "playstation-vita", "playstation-vita-psp", etc.? That architectural problem has to be solved first, or any canonicalization is just a band-aid.
-
How would using the canonical tag work though - because I am using URL rewriting?
For example
mydomain.com/games-playstation-vita-psp/B0054QAS
is acutally something like details.php?=B0054QAS - so how would a canonical tag work in a dynamic template like above.
Because if I placed the tag below in the details.php page then I would need this to change dynamically based on the product - how can this be done?
http://www.mydomain.com/games-playstation-vita-psp/B0054QAS/>
Or would a 301 redirect be better to achieve the above?
Many Thanks
-
To work on the duplicate problem, i think the best option is the cannonical tag. You will need to include in every page (pages you want to be the official one) inside the head tag the follow:
where ww.example.com/index.html is your page adress.
Than, to block old pages that you don't want to be at google, you can use the robots.txt file. There you will use the disallow function.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Why put rel=canonical to the same url ?
Hi all. I've heard that it's good to put the link rel canonical in your header even when there is no other important or prefered version of that url. If you take a look at moz.com and see the code, you'll see that they put the <link rel="<a class="attribute-value">canonical</a>" href="http://moz.com" /> ... pointing at the same url ! But if you go to http://moz.com/products/pricing for example, they have no canonical there ! WHY ? Thanks in advance !
Technical SEO | | Tintanus0 -
Are thousands of 404s a problem?
An ecommerce site I work on has around 16,000 URLs that are 404s in Webmaster Tools. The vast majority are for products that are no longer stocked by the site, which is a natural occurrence in ecommerce. But my question is, could these possibly be harming rankings?
Technical SEO | | creativemay1 -
Why are my URL's changing
My rankings suddenly dropped and when trying to understand why I realized that nearly all images in Google's cached version of my site were missing. In the actual site they appear but in the cached version they don't. I noticed that most of the images had a ?6b5830 at the end of the URL and these were the images that were not showing. I am hoping that I found the reason for the drop in rankings. Maybe since Google cannot see a lot of the content it decided not to rank it as well (particularly since it seems to happen on thousands of pages). This is a cached version of my site I am using the following plugins that might be causing it: Yoasts SEO plugin, W3 total cache. Does anyone know what is causing ?6b5830 to be added to the end of most of my URL's? Could this be the reason for the ranking drop? Thanks in advance!
Technical SEO | | JillB20130 -
SEO url best practices
We're revamping our site architecture and making several services pages that are accessible from one overarching service page. An example would be as follows: Services Student Services Essay editing Essay revision Author Services Book editing Manuscript critique We'll also be putting breadcrumbs throughout the site for easy navigation, however, is it imperative that we build the URLs that deep? For example, could we simply have www.site.com/essay-editing rather than www.site.com/services/students/essay-editing? I prefer the simplicity of the former, but I feel the latter may be more "search robot friendly" and better for SEO. Any advice on this is much appreciated.
Technical SEO | | Kibin0 -
Duplicate content problem?
Hello! I am not sure if this is a problem or if I am just making something too complicated. Here's the deal. I took on a client who has an existing site in something called homestead. Files cannot be downloaded, making it tricky to get out of homestead. The way it is set up is new sites are developed on subdomains of homestead.com, and then your chosen domain points to this subdomain. The designer who built it has kindly given me access to her account so that I can edit the site, but this is awkward. I want to move the site to its own account. However, to do so Homestead requires that I create a new subdomain and copy the files from one to the other. They don't have any way to redirect the prior subdomain to the new one. They recommend I do something in the html, since that is all I can access. Am I unnecessarily worried about the duplicate content consequences? My understanding is that now I will have two subdomains with the same exact content. True, over time I will be editing the new one. But you get what I'm sayin'. Thanks!
Technical SEO | | devbook90 -
How to handle temporary campaign URLs
Hi, We have just run a yearly returning commercial campaign for which we have created optimized URL's. (e.g. www.domain.tld/campaign including the category and brand names after the campaign www.domain.tld./campaign/womens This has resulted in 4500+ URL's being indexed in Google including the campaign name, now the campaign is over and these URL's do not exist anymore. How should we handle those URL's? 1.) 301 them to the correct category without the campaign name 2.) Create a static page www.domain.tld/campaign to which we 301 all URL's that have the campaign name in them Do you have any other suggestions on what the best approach would be? This is a yearly commercial campaign so in a year time we will have the same URL's again. Thanks, Chris
Technical SEO | | eCommerceSEO0 -
Query strings in Canoncials URLs
Video on my site all resides at www.mydomain.com/video in a player that does not assign unique URLs for each video. We may be able to rewrite the URLs to include a unique identifier found in the video's metadata (www.mydomain.com/video/?bctid=17769780). If I did this, how would it impact the canonical URL? Do the SEs accept canonicals with query strings? What if I only changed the canonical URL and did not change the video's URL? Would that be a problem?
Technical SEO | | BostonWright0 -
Trailing Slashes In Url use Canonical Url or 301 Redirect?
I was thinking of using 301 redirects for trailing slahes to no trailing slashes for my urls. EG: www.url.com/page1/ 301 redirect to www.url.com/page1 Already got a redirect for non-www to www already. Just wondering in my case would it be best to continue using htacces for the trailing slash redirect or just go with Canonical URLs?
Technical SEO | | upick-1623910