Question

My site at www.kruaklaibaan.com (yes I know it's hideous) currently has 3.7 million likes but while working to build a proper site that doesn't use some flowery phpBB monstrosity I noticed that all those likes are registered against an invalid URL that doesn't actually link back to my site's URL at all. Instead the likes have all been registered against a URL-encoded version:

www.kruaklaibaan.com%2Fviewtopic.php%3Ff%3D42%26t%3D370

This is obviously incorrect. Since I already have so many likes I was hoping to either get those likes updated to the correct URL or get them to just point to the base url of www.kruaklaibaan.com

The correct url they SHOULD have been registered against is (not url-encoded):

www.kruaklaibaan.com/viewtopic.php?f=42&t=370

Is there someone at Facebook I can discuss this with? 3.7m likes is a little too many to start over with without a lot of heartache. It took 2 years to build those up.

Was it helpful?

Solution

Short of getting someone at Facebook to update the URL, the only option within your control that I could think of that would work is to create a custom 404 error page. I have tested such a page with your URL and the following works.

First you need to set the Apache directive for ErrorDocument (or equivalent in another server).

ErrorDocument 404 /path/to/404.php

This will cause any 404 pages to hit the script, which in turn will do the necessary check and redirect if appropriate.

I tested the following script and it works perfectly.

<?php

if ( $_SERVER['REQUEST_URI'] == '/%2Fviewtopic.php%3Ff%3D42%26t%3D370' ) {
    Header("HTTP/1.1 301 Moved Permanently");
    Header("Location: /viewtopic.php?f=42&t=370");
    exit();
} else {
    header('HTTP/1.0 404 Not Found');
}

?><html><body>
<h1>HTTP 404 Not Found</h1>
<?php echo $_SERVER['REQUEST_URI']; ?>
</body></html>

This is a semi-dirty way of achieving this, however I tried several variations in Apache2.2 using mod_alias's Redirect and mod_rewrite's RewriteRule, neither of which I have been able to get working with a URL containing percent encoded chars. I suspect that with nginx you may have better success at a more graceful way to handle this in the server.

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