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

I recently updated our site taking it from a multi-page site to a single page site.

The problem now is that when the site is searched in say Google, it displays the site as well as the indexed pages. So if a user clicks say our "About" page, it takes them to our now outdated material.

I am hoping to get some guidance on how to properly handle this.

I figure the first step is to now setup a robots.txt on our new index page to tell the engines not to crawl beyond index.php.

But in the meantime, how do I handle the fact that when searching our site on Google we may still have users who try to click on sub-page links?

Should I simply setup redirects while waiting for the engines to update?

And if so, do I need to setup redirects on each page using PHP or is this something I would take care of on our sites control panel?

I am not very familiar with redirects...

Any help is appreciated!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The best thing to do is to use 301 redirects in your .htaccess file. Essentially Google or any browser looking for a page (for this example, the About Us page) gets redirected to the page you want them to see. This is done instantly really, and requires no "You are being redirected, please stand by" messages.

The code is:

RewriteRule ^name-of-old-page/$          /name-of-new-page/         [R=301,L]
share|improve this answer
    
Sounds prefect, does this mean that i need to add an entry for each page that I do not want them to see or is there an inverse way of doing this, i.e. any page EXCEPT index.php -> redirect to index.php? –  Stefan Jul 9 '12 at 14:25
    
I found this lil snippet, does this sound right? RewriteRule !^index\.php$ /index.php [L,R=301] –  Stefan Jul 9 '12 at 14:29
    
Yes you'll have to add it for each page that you wish to redirect. The snippet you have isn't right, it'll be ^index.php$ if you were going to do that. –  mickburkejnr Jul 9 '12 at 14:31
    
Ok sounds good thank you for the help. Now if I add a robots.txt telling the search engines not to crawl beyond index.php, will the engines such as google slowly remove those sub-page links that they show when I search for the site? –  Stefan Jul 9 '12 at 14:35
    
I will be honest, I'm not entirely sure. You could try re-submitting your site to Google, so that it will then recrawl the site. If the pages it used to have can't be found any more then it should remove these. –  mickburkejnr Jul 10 '12 at 7:39
add comment

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.