Am 09.04.2010 21:53, schrieb Ashley Sheridan:
On Fri, 2010-04-09 at 21:29 +0200, 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 <http://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,
Merlin
It looks like the ISP is looking at the header response codes and
capturing the 404 ones. I've seen other ISP's do this and return a
search results page of their own sponsored content.
I think the best way round this is to use the .htaccess redirect rules
instead to deliver the correct content:
RewriteRule ^(.+) /users.php?username=$1
Of course that's only a simple example, and you might need to tweak it
a bit.
This way, no extra header codes are sent to the user, and can't be
captured by anyones ISP.
Thanks,
Ash
http://www.ashleysheridan.co.uk
This sounds like the best solution to me. The only problem is that my
regex knowledge is pretty limited. The command:
RewriteRule ^(.+) /subapp_members/search_user.php
leads to an internal server error, the syntax seams ok?! Could you help
with the correct rewrite rule?
The script search_user.php gets the user name and looks it up in the db:
$parameter = explode('/', $_SERVER[REQUEST_URI]);
$user_name = addslashes($parameter[1]);
So I would need to redirect all potential 404s to that script. How could
that rewriterule look like?