php - Wordpress 重定向循环错误

标签 php wordpress .htaccess loops redirect

让开发人员为 wordpress 构建主题。该站点是 beonpointe.com - 已尝试使其生效并且 url 只是重定向到/index1.html - 主机没有域转发,HTACCESS 中也没有任何域转发。

我在主题的 functions.php 中找到了一个片段,但取消注释以查看它是否有效,但仍然无效。请问有人能帮忙吗?!

代码片段是:

<?php 
define('TEMPLATE_DOMAIN', 'beonpointe'); 
define('BOP_IS_LIVE', 'true'); 

function only_admin_access(){ 
    if( BOP_IS_LIVE == 'true' ): 
        if( !is_user_logged_in() ): 
            wp_redirect( site_url('') ); 
        endif; 
    endif; 
}
add_action('wp_top_head', 'only_admin_access'); 
?>

非常感谢。提前谢谢你。

最佳答案

<?php 
define('TEMPLATE_DOMAIN', 'beonpointe'); 
define('BOP_IS_LIVE', 'true'); 

function only_admin_access(){ 
    if( BOP_IS_LIVE == 'true' ): 
        if( !is_user_logged_in() ): 
           wp_redirect( home_url() ); 
           exit;
        endif; 
    endif; 
}
add_action('wp_top_head', 'only_admin_access'); 
?>

More info ro redirect

关于php - Wordpress 重定向循环错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27558682/

相关文章:

database - 关于使用 mod_rewrite 获得干净 URL 的问题

javascript - SSE 非常慢

php - 复杂的 MySQL 加入动态 where

php - CodeIgniter 查询构建

wordpress - 当对特定图像的请求来自 ie8 时,服务器返回 404

php - PHP 的 Google 应用引擎不加载 mysql

php - 对于下拉列表如何为单个选项添加类

php - 如何使自定义帖子元 wp_editor 可翻译?

java - 如何使用 .htaccess 来加速 Spring 网站为不同类型的文件自定义浏览器缓存

php - .htaccess 在 Ubuntu Server x64 上不起作用