制作多语言网站、复制粘贴页面的最佳解决方案是什么?脚本?
我已经做了一个名为 Kinouk 的网站
问题 1)
French = https://www.kinouk.com/fr English = https://www.kinouk.com
每个索引页面都会检查用户是否是新用户,如果是,我们将他重定向到正确的index.php(取决于他们的浏览器语言,然后设置一个cookie,以便下次他访问网站时他将获得重定向),并且如果用户在使用英语时单击法语按钮(左上角),则会发生变化饼干对法国人的价值所以他下次会得到法语版本。
这样好吗?我听说谷歌不喜欢重定向页面
问题2)
有人知道一个好的文件上传脚本+用于上传多个文件、缩放图片和创建缩略图的按钮吗?我只能找到单个文件上传脚本,这不是那么“酷”。
I already done a website called Kinouk
Question 1)
French = https://www.kinouk.com/fr
English = https://www.kinouk.com
Each index page is checking if the user is new, if so we redirect him to the right index.php ( depending on their browser language and then set a cookie so next time he get on site he will get redirect ) and if the user click on french button ( top left ) when he is in english it change the cookie value to french so he will get to french version next time.
Is that good? I heard google do not like redirect pages
Question 2)
Anyone know a good file upload script + button for uploading Multiple files, scale pictures and create a thumbnail? I can only find single file upload script which isn't that "cool".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题 1
您可以检查是否使用 PHP 设置了 cookie,它是很好的服务器端
$_COOKIE
数组,并相应地设置header()
。这意味着不会出现混乱的客户端重定向和半加载页面的闪现。问题 2
我很惊讶您还没有Uploadify。您需要使用 GD 缩放图像服务器端,但有很好的课程周围和关于(更多关于Google)。
Question 1
You can check if a cookie is set using PHP and it's nice
$_COOKIE
array, server side, and set theheader()
accordingly. This means there's no messy client-side redirect with a flash of half-loaded page.Question 2
I'm suprised you haven't head about Uploadify. You'll need to scale the images server side using GD, but there are nice classes for it around and about (more on Google).
你做错了
设置cookie并在不存在cookie时重定向意味着你的网站仅对一种/你的默认语言的搜索引擎可见 - 因为在每个请求中,搜索引擎机器人都会被“检测”为新用户并重定向。
为了能够以另一种语言查看网站而被迫接受 cookie(或编辑接受的语言)也是一种烦人的用户体验。
更好的方法
如果 cookie 存在,请务必在访问的第一个请求上重定向 - 但它应该是一个显式操作,或者设置 cookie 的 javascript;实际上,不是任何和所有请求。应该仍然可以用另一种语言查看网站,而无需跳过任何麻烦 - 即,如果有“用法语查看此页面”链接,它需要为所有用户执行其所说的。
You're doing it wrong
Setting a cookie and redirecting when no cookie is present will mean your site is only visible to search engines in one/your default language - because in every request the search engine bot will be 'detected' as a new user and redirected.
It's also an annoying user experience to be forced to accept cookies (or edit accepted languages) just to be able to view a site in another language.
Better approach
If the cookie is present, by all means redirect on the first request of a visit - but it should be an explicit action, or javascript which sets the cookie; not, effectively, any and all requests. It should still be possible to view the site in another language without jumping through hoops - i.e. If there is a 'view this page in french' link, it needs to do what it says for all users.