Re: Re: 404 redirects "stolen" by provider
| From: | Ashley Sheridan | Date: | Fri, 09 Apr 2010 20:05:58 +0000 |
| Subject: | Re: Re: 404 redirects "stolen" by provider | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-303958@lists.php.net to get a copy of this message | ||
On Fri, 2010-04-09 at 21:03 +0100, Nathan Rixham wrote:
> Merlin Morgenstern wrote:
> > Hello,
> >
> > I am running a website under apache and php where I do redirects on 404
> > errors:
> >
> > apache conf:
> > ErrorDocument 404 /subapp_members/search_user.php
> >
> > This is done to allow ULRs with usernames like this:
> > www.server.com/username
> >
> > The PHP script search_user.php looks in a db if the user name is
> > existent and if yes shows his member page. If the name is not existent
> > it displays an internal 404 message.
> >
> > This worked perfectly for recent years until now. Some users complain
> > that they do see advertisement instead of the page. A research showed
> > that they are using a provider called "unitymedia". As soon as a site
> > has a page not found error it redirects them to their own advertisement
> > page. This is true for all pages on the net. e.b. ebay.com/testing shows
> > their advertisement.
> >
> > Has somebody an idea on how to fix that from my site?
> >
> > Thank you for any help,
> >
>
>
> yup, use a 303 See Other first of all
>
> ErrorDocument 303 /subapp_members/search_user.php
>
> then continue as normal; if you don't find the user set the status
> header to 404 and show your internal 404.
>
> They may never see the internal 404; but in many browsers they won't any
> ways as most delegate it through to a "can't find, search with the
> google?? :-)" type page.
>
> regards!
>
Sending any headers other than a 200 is still inviting this dubious ISP
to redirect it's customers to its own pages in an effort to gain
revenue. The ideal solution is to use mod_rewrite within the .htaccess
file, as this is completely transparent and the end user is non the
wiser.
Thanks,
Ash
http://www.ashleysheridan.co.uk