启用多站点网络
编辑文件 wp-config.php,并在之前添加以下行即可完成,停止编辑!开始博客。
1 2 3 | /* Multisite */ define('WP_ALLOW_MULTISITE', true); // 开启多站点功能 define( 'COOKIE_DOMAIN', '' ); // 清除cookie限制,否则开启多站点后登录网站后台会提示“错误:Cookies被阻止或者您的浏览器不支持。要使用WordPress,您必须启用Cookies。” |
注意:不要添加到最后,您应该将其添加到下面到代码之前:
1 2 3 | /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); |
保存你的 wp-config.php 文件并登录到你的 WordPress 网站。转到工具» 网络设置。这是你将配置和设置 WordPress 多站点网络的地方:
启用多站点之前要关闭所有插件,
https://blog.csdn.net/lypblog/article/details/83960398
Add the following to your wp-config.php file above the line reading /* That’s all, stop editing! Happy publishing. */:
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'www.xslrobot.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
Add the following to your .htaccess file, replacing other WordPress rules:
RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]
根目录下新建 en-global zh-cn
搭建中英文双语网站?WordPress多语言插件了解一下
https://www.chukuangren.com/wordpress-shuangyu.html
https://wpfanyi.com/plugins/multilingual-press
WPML中文版多语言插件【免费】【V4.4.9】
http://www.4mudi.com/themes/wpml/ 这个网站下的,可能有木马
https://chenghongli.com/zh/tech/wordpress-multilingal-lamp-multisite-sub-directory/
WordPress多语言站点实现–LAMP+WordPress Multisite(sub-directory)
如果不同语言间的文章内容基本相同,优先考虑多副本方法;
插件不够完美可以考虑多语言方法;
如果不同语言之间的文章内容基本不同,优先考虑多站点方法;
如果不知道怎么翻译或者翻译量巨大,但是又想设立这个语言的网站,可以使用机翻的方法,最好还是付费机翻,效果要好一些。
https://wordpress.com/zh-cn/support/set-up-a-multilingual-blog/
- 选项 1:一个站点,一篇文章
- 选项 2:一个站点,两篇文章
- 选项 3:两个站点
https://wordpress.com/zh-cn/support/menus/ 自定义菜单
参考 synology.com 网站,应该是多站点,多站点可能会麻烦些,但对于后期来说,应有优势,毕竟说独立的;
默认跳转到子站点:简单粗暴
根目录建立一个网页index.html,自动跳转子站点 en-global
<meta http-equiv=“refresh” content=“0;url=https://10001blog.xslinc.com/en-global/”>
</html>
前端 JavaScript 获取用户浏览器默认语言设置,自动判断跳转不同网站 https://www.axihe.com/anbang/blog/web/auto-i18.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <script type="text/javascript"> //获取用户语言的顺序是 //1.获取本地缓存里的内容 //2.用户浏览器的语言设置 //如果上面2个都没有获取到,就直接使用'en'作为用户选择的语言 var language = localStorage.getItem('locale') || window.navigator.language.toLowerCase() || 'en' //把用户的语言写入缓存,供下次获取使用 localStorage.setItem('locale', language) //判断用户的语言,跳转到不同的地方 if (language.indexOf("zh-cn") !== -1) { window.location = '/zh-cn' } else if (language.indexOf('en') !== -1) { window.location = '/en-global' } else { //其它的都使用英文 window.location = '/en-global' } </script> |
WordPress根据浏览器语言自动跳转网址的方法 https://blog.naibabiji.com/skill/language-redirection.html
选择语言: https://10001blog.xslinc.com/en-global/xxx 跳转到 https://10001blog.xslinc.com/zh-cn/xxx 类似synology.com
jQuery点击图片开启,再次点击图片关闭效果
https://blog.csdn.net/qq_36538012/article/details/107508490
All Languages name HTML Drop Down List https://www.html-code-generator.com/html/drop-down/languages-name
阿里云这么多节点
华东 1 oss-cn-hangzhou.aliyuncs.com 华东 2 oss-cn-shanghai.aliyuncs.com 华北 1 oss-cn-qingdao.aliyuncs.com 华北 2 oss-cn-beijing.aliyuncs.com 华北 3 oss-cn-zhangjiakou.aliyuncs.com 华北 5 oss-cn-huhehaote.aliyuncs.com 华南 1 oss-cn-shenzhen.aliyuncs.com 香港 oss-cn-hongkong.aliyuncs.com 美国西部 1 (硅谷) oss-us-west-1.aliyuncs.com 美国东部 1 (弗吉尼亚) oss-us-east-1.aliyuncs.com 亚太东南 1 (新加坡) oss-ap-southeast-1.aliyuncs.com 亚太东南 2 (悉尼) oss-ap-southeast-2.aliyuncs.com 亚太东南 3 (吉隆坡) oss-ap-southeast-3.aliyuncs.com 亚太东南 5 (雅加达) oss-ap-southeast-5.aliyuncs.com 亚太南部 1 (孟买) oss-ap-south-1.aliyuncs.com 亚太东北 1 (日本) oss-ap-northeast-1.aliyuncs.com 中东东部 1 (迪拜) oss-me-east-1.aliyuncs.com 欧洲中部 1 (法兰克福) oss-eu-central-1.aliyuncs.com 英国 1 (伦敦) oss-eu-west-1.aliyuncs.com https://www.jb51.net/article/61807.htm PHP判断浏览器、判断语言代码分享
根据来访域名跳转不同的页面 https://goodtext.org/network/html/id/7.html
- 修改 index.php 为 index1.php
- 修改 .htaccess
RewriteRule . /index.php [L] 改为 RewriteRule . /index1.php [L] - 新建 index.html
Leave A Comment