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

We're launching new website with new url structure and new content. Domain is the same. Many old pages are indexed by google. Should I use 404 or 301 and redirect to '/' for these old resources? I also want to remove these pages from google index.

share|improve this question

migrated from stackoverflow.com Dec 13 '11 at 13:11

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

2 Answers 2

up vote 7 down vote accepted

Use HTTP 410 (Gone) for pages you'd like to stop from being indexed.

For changed URLs with the same content use HTTP 301 (Moved Permanently).

share|improve this answer
    
It's impossible to redirect exactly to new url, all redirects need to point main site. 410 returns default browser error page I would like to redirect user to new location (based on 'location' header) –  mm1 Dec 13 '11 at 12:26
    
Since the question is tagged google-index, I assumed it was about Google indexing your page... There's no "default browser error page" on Google. Maybe you'll need to base your HTTP response codes on the User-Agents? –  Linus Kleen Dec 13 '11 at 12:29
    
giving different HTTP response codes to different User-Agents is a bad idea and opens you to Google thinking you look spammy. –  joshuahedlund Dec 13 '11 at 17:37

If the content has moved permanently, then a 301 response is the correct thing to do (and point it to the new location, not a generic point); If the content has gone forever, you should use the 410 response which means "Gone". Of course, where there is an alternate, you can use a 303 response (along with the URL to the alternate) which can be worthwhile when there isn't an exact match.

share|improve this answer

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.