2017-09-28 166 views
0

我正在使用Wordpress重定向插件將主頁重定向到網站上的另一個頁面。查詢字符串不重定向的Wordpress重定向URL

/重定向到example.com/project-management-online-short-course/

然而,當我鍵入像example.com/?s=randomstring一個URL它不重定向。

我試過幾個正則表達式字符串似乎沒有工作。是否有可能捕獲這些查詢字符串?

回答

0

把下面的代碼放在你的functions.php中,激活主題。

function check_user_on() 
{ 
    if (!is_admin() && !is_login_page()) 
    { 

     //flag false redirecting user to live site 
     wp_redirect('https://example.com/location-new'); 
     exit; 

    } 

} 
add_action('init','check_user_on'); 
0

您可以用此查詢簽出希望這對你有幫助。

 <?php /* 
     Template Name: Your Custom page redirect 
      */ 

     header('Location: http://example.com/project-management-online-short-course/'); 
     exit(); 

     ?> 

如果不工作,你可以用這個鏈接籤: - https://wordpress.org/plugins/redirection