在 Twitter 上分享时 URL 中的阿拉伯字符 [英] Arabic characters in URL while sharing on Twitter

查看:28
本文介绍了在 Twitter 上分享时 URL 中的阿拉伯字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试在 Twitter 上共享包含阿拉伯字符的 URL 时遇到问题:

I'm facing an issue trying to sharing an URL which includes arabic characters on Twitter:

http://example.com/قرعة-تصفيات-أفريقيا-مصر-تواجه-نيجيريا/

当我点击分享"时,推文框中会显示相同的 URL,但当我实际推文时,它只链接到 http://example.com,其余的网址丢失.

When i click on "share" the same URL is showed in the tweet box, but when I actually tweet, it just links to http://example.com, and the rest of the URL is lost.

我尝试使用 urlencode(),但生成的 URL 太长且无法推文.我该如何解决这个问题?

I tried using urlencode(), but the generated URL is too long and impossible tweet. How could I solve this?

推荐答案

如果您是网站所有者,您可以编写 htaccess RewriteRule 来生成较短或英文的 url 或使用重定向文件.

If you are owner of website, you can write htaccess RewriteRule for generate shorter or English url or use Redirection file.

RewriteEngine on 
RewriteRule ^redirect/(.*)/?$ ./redirector.php?key=$1 [QSA,L,NC]

如果您是网站用户,您可以使用网址较短的网站,例如 bit.lygoo.gl

And if you are user of website just you can use URL shorter websites like bit.ly or goo.gl

这篇关于在 Twitter 上分享时 URL 中的阿拉伯字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆