开发者

URL Rewriting and Facebook link information retrieval

I am developing a website and I want to integrate it with Facebook, allowing users to share the pages of my website in their FB walls. My problem is explained in the following lines and my question is at the end.

I am using the following URL rewriting rule in my .htaccess file:

RewriteRule ^([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?$ index.php?p1=$1&p2=$2

That means it will rewrite anything like: http://address/parameter1/parameter2 as http://address/index.php?p1=parameter1&p2=parameter2.

When I post http://address/parameter1/parameter2 on FB, it will only show the rewritten URL under that URL.

I posted http://address/index.php?p1=parameter1&p2=parameter2 on FB, and it will show the information I want it to show, the ones I have put in the meta tags.

I tried debugging http://address/parameter1/parameter2 on the FB debugger (http://developers.facebook.com/tools/debug), I will get the error: "The page at ... could not be reached because the server returned status code 400."

Is there any way I can correct that? That is, actually making the dynamic link behave like a static link, and making that transparent to anyone who links it?


Edit:

This change in the rewrite rule should solve the problem: RewriteRule ^([a-z0-9_-]+开发者_如何学编程)/?([a-z0-9_-]+)/?$ index.php?p1$1&p2=$2 [L,NC]

I also changed the redirects in PHP that I was doing.

And that solved my problem.


I have similar issue to yours, except I manage url rewriting with php dynamically. I am currently a web host that do not allow url rewriting through htaccess (free.fr)

dynamic standard url is handled properly. But not rewrited url.

How would you get rid of this, considering header status code?

What I could do is doing a redirect instead of include script which produce html output code. Just have to tell the handler to switch between include and redirect, thanks to a special added param in the url. But it's not a pretty solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜