Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A client has requested that all site visitors arrive to internal pages via the home page. At present a lot of visitors are hitting internal pages directly from google search results. Are there any techniques for channeling users ?

Apologies if this is a stupid question.

share|improve this question

migrated from stackoverflow.com Jun 29 '11 at 4:34

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

If something has a URL, and the user puts that URL into their web browser, they'll see whatever is there. That's kind of how the web works. Any way of doing what your client wants requires making the web site as a whole less usable in some way. – camccann Jun 27 '11 at 17:34
Have you asked what they're trying to achieve with this request? Sometimes clients skip ahead to a (wrong-headed) solution and just ask for that, when the reasoning behind it might suggest other options. – Su' Jun 29 '11 at 8:53

Redirecting visitors to the homepage when they've requested a subpage is generally a bad idea because:

  • Search engines will cease to index subpage content, resulting in big traffic drops.
  • Users will struggle to find the information that brought them to the site in the first place.

However, if there's a very good reason to do so (and I can think of few), there are a couple of ways to redirect visitors to the homepage if they hit a subpage:

  • Check for the existence of a cookie that's only set if they've visited the homepage.
  • Check that the HTTP referrer belongs to the same domain.

Note that neither of these methods are foolproof, as both cookies and referrer information can be spoofed, but they will probably suffice for basic use.

A better alternative to the redirection system your client has asked for might be to detect that it's the first time a visitor's been to the site (with cookies), then show them a welcome message -- either inline with the HTML or as a subtle animated overlay -- prompting them to visit the homepage or read an FAQ to learn more, a bit like sites on the Stack Exchange network do. (Click for large view):

Stack Exchange welcome box

share|improve this answer

Your Answer


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.