Question

I have a problem regarding social buttons: facebook like and google plus that don't work. It's a special case because the URL contains accents and it conflicts with the encoded form. Anyways, now I try to handle both requests with PHP. It wouldn't be neccessary because browsers are intelligent enough to redirect, but these social apps test the URL for errors. If the URL to like or plus one seems to be invalid (responds 404), you cannot like or plus anything.

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

ErrorDocument 404 /index.php

This is the relevant part of .htaccess for you to get a closer image of the URL structure.

The problem is, the URL looks like:

http://business1.hu/makrogazdaság/a-snowden-ügy-nyertesei

The encoded form, http://business1.hu/makrogazdas%C3%A1g/a-snowden-%C3%BCgy-nyertesei if typed into a browser address field, the browser will say: Okay, I know this is a URL endoded form, I'd better decode it and show the actual page. But this url itself returns no content, a 404 PAGE. And I couldn't solve this in PHP.

So the thing I type in after http://business1.hu/ seems to return a 404 error and SHOWS CONTENT at the same time.

I guess /makrogazdaság returns 200, but /makrogazdas%C3%A1g returns 404. They are meant to show the same exact page. But Facebook cannot handle /makrogazdaság.

Please help.

Was it helpful?

Solution

You won't believe how simple it was.

header("Status: 200 OK"); solved everything.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top