Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

My current URL is: www.example.com/category/we-developer/ However, if any user mistakenly adds extra characters after the /, for example, www.example.com/category/we-developer/fgggfgg, it should take him to a 404 page. But instead, the user is again viewing the previous page (www.example.com/category/we-developer/)

This is why Google is showing it as a duplicate page. What I wish is that instead of opening the same page, the user would be taken to a '404` page.

Can you advise on how to do this? Note that my site is using CodeIgniter.

share|improve this question

migrated from serverfault.com Jun 26 at 11:23

This question came from our site for professional system and network administrators.

1  
Google won't make links up. If you've not linked to www.example.com/category/we-developer/fgggfgg anywhere, then Google won't try to index it. Google follows links, it doesn't guess URIs. –  i-CONICA Jun 26 at 9:57
    
You need to fix the problem in your CMS code. I assume CodeIgniter has a routing system similar to Symfony 2. You need to check the routing rules there. –  Tero Kilkanen Jun 26 at 10:55

2 Answers 2

I wouldn't necessarily serve up a 404.

If users are actually linking to your content this way, then changing your application to serve up a 404 will result in a loss of backlinks. i.e. All links to www.example.com/category/we-developer/fgggfgg will be lost. Instead, I would make use of canonical URLs:

<link rel="canonical" href="http://www.example.com/category/we-developer/" />

This will tell Google that the original content is on http://www.example.com/category/we-developer/ and that said content can be accessed via multiple URLs.

This way, you fix the duplicate content issue without losing out on previously-posted links.

share|improve this answer
2  
But however, if a URI does not exist on the domain, it should still serve a 404 error, not resolve to the parent page. The URI fgggfgg does not exist. –  zigojacko Jun 26 at 12:09
1  
If users are clicking on said link and content is being served, with no 404 being thrown, then the link does exist, despite the fact that it is duplicate content. –  Wexford Jun 26 at 12:12
2  
The link exists in Google's index - it doesn't actually exist on the website so a 404 error should be served. The website isn't configured correctly to serve 404's if the page doesn't exist. –  zigojacko Jun 26 at 13:40
1  
OP said that it does exist on the website. That the content from the page www.example.com/category/we-developer/ is being shown. This makes sense, seeing as many frameworks view the third part of the URL as a controller function parameter. –  Wexford Jun 26 at 14:14
1  
@zigojacko Because throwing a 404 could result in a loss of backlinks. Also, because he's using a framework, it doesn't require a lot of code. Just construct the URL and insert it into the view. –  Wexford Jun 26 at 14:37

CodeIgniter's code sounds actually quite good for usability - if it can't find a page, it takes you to the category where that page is likely to be rather than returning nothing.

Pages you have knowingly changed the URL of are better 301d rather than 404d so they go to exactly the right page.

The only potential duplicate content problem here is if Google accidentally index the wrong version of a page. They could only do that if any links are pointing to the wrong URL. It is not going to be treated any more a new page than the fact that every site on the web can have new duplicate pages by appending a parameter to the URL. They are usually pretty good at recognising which URL is canonical. If not, help them out with a canonical tag.

(If you really need to change the routing rules, then a Google tells me they are set at application/config/routes.php - though make sure you follow any override guidelines instead of hacking at core code)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.