wordpress绑定独立域名3种方法

wordpress绑定独立域名3种方法

wordpress绑定独立域名3种方法

方法1:插件名称:Domain Theme

可以直接后台搜索安装,这个插件最大的功能就是给wordpress绑定不同的域名并且指定不同的主题以及网站标题,其实对于老老实实做站而言,一个站用多个域名并没有多少好处,不过用在给站点添加wap移动站点的话,那就刚刚好了。

方法2:插件名称:WP Mobile Edition
直接后台插件搜索安装,相比Domain Theme插件已经很多年没有更新了,WP Mobile Edition支持wordpress4.5以上的版本,并且功能更加强大,可以自由选择主题调度是根据浏览器来识别还是绑定域名。

方法3:

/*根据浏览器跳转*/define ('MOBILE_DOMAIN', 'm.fengku.net');define ('REAL_DOMAIN', 'www.fengku.net'); if ($_SERVER['SERVER_NAME'] == MOBILE_DOMAIN) {define('WP_HOME' ,'http://' . MOBILE_DOMAIN);define('WP_SITEURL',WP_HOME);define('TEMPLATEPATH', ABSPATH .'wp-content/themes/Ripple_mobile/');define('STYLESHEETPATH', ABSPATH .'wp-content/themes/Ripple_mobile/'); define ('MOBILE_THEME', true);}elseif(strpos($_SERVER['HTTP_USER_AGENT'],'baidu Transcoder')){ //百度转码跳转header('Location: '. 'http://' . MOBILE_DOMAIN . $_SERVER["REQUEST_URI"]);die();}else{ if (!empty($_GET['m_action'])) {if ($_GET['m_action'] == 'nomobile') {setcookie('wordpress_mobile_domain_disable', 1, time()+86400, '/', REAL_DOMAIN, false);if (!empty($_SERVER['HTTP_REFERER'])) {$go = str_replace(MOBILE_DOMAIN, REAL_DOMAIN, $_SERVER['HTTP_REFERER']);header ('location:'.$go);die();} else {header ('location:'.REAL_DOMAIN);die();}}}$browsers = array ('Googlebot-Mobile','Opera Mini','iPhone','BlackBerry','iPod','Android','Bolt','IEMobile','GoBrowser','Skyfire','TeaShark','UC Browser','UCWEB','Opera Mobi','Mobile Safari','SEMC-Browser','Teleca','Series60','Doris','2.0 MMP','240x320','400X240','AvantGo','Blazer','Cellphone','Danger','DoCoMo','Elaine 3.0','EudoraWeb','hiptop','KYOCERA WX310K','LG U990','MIDP-2.','MMEF20','MOT-V','NetFront','Newt','Nintendo Wii','Nitro','Nokia','Palm','PlayStation Portable','ProxiNet','SHARP-TQ-GX10','SHG-i900','Small','SonyEricsson','Fennec','TS21i-10','UP.Browser','UP.Link','Windows CE','WinWAP','LG-TU915 Obigo','LGE VX','Iris','Maemo Browser','MIB','Kindle Basic Web','Myriad Browser','Obigo Browser','Polaris Browser','uZardWeb','WebOS','Deepfish','Dolphin','Firefox Mobile','ibisBrowser','JOCA','Links','Minimo','Pixo','Skweezer','Steel','Tristit','Vision Mobile Browser','Dorothy','Ovi Browser');foreach($browsers as $browser) {if (preg_match("/".$browser."/i", $_SERVER['HTTP_USER_AGENT'])) {if (!isset($_COOKIE['wordpress_mobile_domain_disable'])) {header ('location:http://' . MOBILE_DOMAIN . $_SERVER['REQUEST_URI']);die();}}}}

转载请注明出处::【风酷SEO】 » wordpress绑定独立域名3种方法