Categories

Featured templates

WordPress. 如何使用PHP重定向创建从主页到任何URL的重定向

Guillaume Dumas January 2, 2020
Rating: 5.0/5. From 1 vote.
Please wait...

本教程将向您展示如何创建 redirect 从WordPress主页到使用PHP的任何URL redirect.

WordPress. 如何使用PHP重定向创建从主页到任何URL的重定向

In order to add a redirect function to your WordPress template, you should perform the following:

  1. Log into your Dashboard and go to Appearance -> Editor, select Home Page Page Template (page-home.php):

    WordPress._How_to_create_a_redirect_from_a_home_page_to_any_URL_using_the_PHP_redirect-1

    If you don’t have the Home Page 页面模板在你的主题文件夹,你应该复制到那里. 为此,您需要复制该文件 page-home.php from the directory wp-content/themes/CherryFramework to wp-content/themes/themeXXXXX.

  2. Let’s, as an example, redirect our home page to the contact page. 的前面添加下面的代码 get_header(); function:

    $location = get_site_url() . "/contact";
    wp_redirect( $location, 301 );
    exit;						

    WordPress._How_to_create_a_redirect_from_a_home_page_to_any_URL_using_the_PHP_redirect-2

    的任何内部/外部位置 $location variable. 如果它是一个内部位置,则应该追加对 get_site_url() function before the slug as shown in the example above.

  3. Save the changes to the page-home.php file by clicking on the Update File button:

    WordPress._How_to_create_a_redirect_from_a_home_page_to_any_URL_using_the_PHP_redirect-3

    现在,当您输入您的主页URL,它会自动 redirect to another page. 控件之外的任何页面模板都可以使用此方法 Home Page page template.

请随时查看下面的详细视频教程:

WordPress. 如何使用PHP重定向创建从主页到任何URL的重定向

如何通过网站维护服务将WordPress页面重定向到另一个URL

处理一个WordPress页面和它的功能是相当简单的,即使没有吸引技术专家. However, 如果一个页面所有者想节省他们的时间在现场他们的维护, 它适用于Templateog体育首页的专业人士 WordPress Website Maintenance & Support.

适合WordPress的管理工具 redirect 主页只是Templateog体育首页可以提交的20多个任务之一. 紧急护理,定期报告,和现场 performance 支票作为订阅的一部分是负担得起的.

Templateog体育首页支持服务将帮助以下页面所有者:
  1. 开始和一个新的或想要的人一起工作 update an existing site.
  2. Want to redirect WordPress页面到另一个URL,但无法自己管理它.
  3. Possess no time to maintain and update the operation of the current site.
  4. 需要专家帮助如何管理多个web段.
  5. 我希望确保他们的页面不受任何形式的 malware,在各种设备上提供相关的加载速度,并保持最新.

The maintenance & 支持部门还可以为企业主开发定制的援助工具包. It helps to redirect the WordPress page to another URL. 该包将包括建立一个页面与任何主题从网络,加快网站 performance, and boost the site conversion and SEO.

Templateog体育首页提供每月或每年一次的服务. 网站所有者可以从两个支持包中选择:基本或高级. 除了日常备份,紧急护理,积极主动 plugin 高级套餐提供茶点和其他一些基本服务:
  • SEO basic setups and advisory;
  • Security protection;
  • Developer’s hours;
  • WooCommerce support.

此外,有特殊要求的网站所有者,如.g. WordPress redirect function,他们的个人套餐将获得10%至20%的折扣. 套餐价格从29美元/月或289美元/年起.

While searching for tips on how to redirect 链接到WordPress中的另一个页面,就像订阅Templateog体育首页支持服务一样. 一组技术专家将检查并保管 software 按照目前的标准,负责每日和每周的备份,并就如何备份提出建议 redirect a page in WordPress.

请求Templateog体育首页年度订阅, 页面所有者将免费使用两个月, opportunity to pay online secure, cancel the subscription at any time, 并在购买后两周内退款.

Templateog体育首页维护订阅为企业所有者提供了一名指定的管理人员,该管理人员将概述站点的运行情况,并在出现问题时将其与技术部门联系起来.

处理任务,如WordPress页面 redirect,支持团队需要访问 hosting and admin panel. 顺便说一下,在什么方面没有区别 hosting 是否用作支持服务与多个协作 hosting providers.

Within the Developer’s Hours, Templateog体育首页专家将能够添加和更改内容, edit the HTML,修改CSS文件,安装和配置现有的插件.

Read more about the Website Maintenance Services here.

Coolest Wordpress Themes
This entry was posted in WordPress Tutorials and tagged home, page, php, redirect, WordPress. Bookmark the permalink.

Submit a ticket

如果您仍然无法找到关于您的问题的足够的教程,请使用以下链接向我们的技术支持团队提交请求. 我们将在接下来的24小时内为您提供我们的帮助和协助: Submit a ticket