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

As far as I understand, you should have a single URL to access a given page on a website to prevent duplicate issues. With this in mind I have setup IIS7 Rewrite to point my friendly URLs to my .aspx pages. e.g. /category/widgets/ has a rewrite to /category.aspx?id=widgets

Should I allow either of these URLs to resolve my web page, or should I also 301 redirect /category.aspx?id=widgets to /category/widgets/ so that there is only a single URL that resolves the page?

share|improve this question

migrated from stackoverflow.com Dec 22 '11 at 5:46

This question came from our site for professional and enthusiast programmers.

    
What is a 301 rewrite? If you're rewriting the URL, then it shouldn't be sending a 301 redirect response. The rewriting should happen internally with the client simply receiving a 200 OK response with the contents. –  Lèse majesté Dec 22 '11 at 6:33
    
Yes, you're right. I've edited the question accordingly. –  AlexCambridgeUK Dec 22 '11 at 6:59
    
Thanks for fixing that. I was just worried that you might create a redirect loop if you have two 301 redirects pointing to each other. –  Lèse majesté Dec 22 '11 at 7:01

1 Answer 1

up vote 2 down vote accepted

Yes, you should 301 redirect /category.aspx?id=widgets to /category/widgets/ so that there is only a single URL that resolves the page.

Make sure that you don't accidentally create a redirect loop.

The alternate way is to use the rel="canonical" meta-tag in your code, but as you are using IIS7 the redirect should be simpler to implement.

share|improve this answer
    
As an alternative to the 301 redirect, would I be better returning a 404 response to /category.aspx?id=widgets? –  AlexCambridgeUK Jan 10 '12 at 11:48
    
No - your original pages may have links pointing to them. Returning a 404 will cause any reputation built up to be lost. Pass the reputation along by redirecting with a 301. –  Ciaran Jan 11 '12 at 15:29

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.