在线服务器上的本地而不是作品WordPress站点工作(wordpress site work on

2019-11-02 12:22发布

我的WordPress网站正常工作本地服务器上,但是当我上传在服务器404找不到网页错误显示。

我检查我的index.php其正确重定向。 这里是代码: -

      <?php

       define('WP_USE_THEMES', true);

       /** Loads the WordPress Environment and Template */
         require('./wp-blog-header.php');
             ?>

我检查我的WP-博客 - 的header.php,其还working.because我把它转发到的phpinfo页面和信息页面的表现,但网站页面不显示。 这里是WP-博客头代码: -

  if ( !isset($wp_did_header) ) { $wp_did_header = flase; require_once( dirname(__FILE__) . '/wp-load.php' ); wp(); //wp_redirect( ABSPATH . WPINC . '/template- loader.php' , 301 ); // exit; require_once( ABSPATH . WPINC . '/template-loader.php' ); } ?> 

我临时-loader.php是: -

       <?php
      /**
     * Loads the correct template based on the visitor's url
        * @package WordPress
       */
    if ( defined('WP_USE_THEMES') && WP_USE_THEMES )
do_action('template_redirect');

     // Halt template load for HEAD requests. Performance bump. See #14348
       if( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) )
exit();

       // Process feeds and trackbacks even if not using themes.
       if ( is_robots() ) :
do_action('do_robots');
return;
    elseif ( is_feed() ) :
do_feed();
return;
       elseif ( is_trackback() ) :
include( ABSPATH . 'wp-trackback.php' );
return;
         endif;

    if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
$template = false;
if     ( is_404()            && $template = get_404_template()            ) :
elseif ( is_search()         && $template = get_search_template()         ) :
elseif ( is_tax()            && $template = get_taxonomy_template()       ) :
elseif ( is_front_page()     && $template = get_front_page_template()     ) :
elseif ( is_home()           && $template = get_home_template()           ) :
elseif ( is_attachment()     && $template = get_attachment_template()     ) :
    remove_filter('the_content', 'prepend_attachment');
elseif ( is_single()         && $template = get_single_template()         ) :
elseif ( is_page()           && $template = get_page_template()           ) :
elseif ( is_category()       && $template = get_category_template()       ) :
elseif ( is_tag()            && $template = get_tag_template()            ) :
elseif ( is_author()         && $template = get_author_template()         ) :
elseif ( is_date()           && $template = get_date_template()           ) :
elseif ( is_archive()        && $template = get_archive_template()        ) :
elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :
elseif ( is_paged()          && $template = get_paged_template()          ) :
else :
    $template = get_index_template();
endif;
if ( $template = apply_filters( 'template_include', $template ) )
    include( $template );
return;
       endif;
         ?>

我htaccess文件是: -

    Options +FollowSymlinks
      RewriteEngine on
         # BEGIN WordPress
       <IfModule mod_rewrite.c>
          RewriteEngine On
         RewriteBase /
         RewriteCond %{REQUEST_FILENAME} !-f
           RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        </IfModule>
        # END WordPress


    # PROTECT WP-CONFIG 
        <Files wp-config.php> 
           order Allow,Deny 
          Deny from all
           </Files>

PLZ告诉我如何联机运行我的网站。

Answer 1:

确实使用WordPress时,这是一个非常令人沮丧的问题。 但我会尽力分享一些经验,我有。

0) 使能调试模式 :在wp-config.com变化WP_DEBUG为TRUE,并添加下列行:

error_reporting(E_ALL);
ini_set('display_errors', true);

有了这个,我们将有WP显示了更多的错误比我们想要的;)

提示:用它在本地计算机上进行防弹插件/主题/项目

1) 检查404是从默认浏览器或从WordPress的 :尝试访问可湿性粉剂管理员的网址。 这是检查是否域设置正确的好方法。 有时,错误是index.php文件不被发现,因此,我们需要加载的东西,也不会关心插件和主题,这就是我建议用可湿性粉剂管理员的原因。

提示:即使一个主题少安装,将有可湿性粉剂管理员工作

2) 删除任何可以成为问题 :如果我们不能准确地找到什么是错上前面的步骤,我们需要得到脏:重命名的主题插件文件夹,以确保问题没有任何的插件。

提示:有时在插件文件的开头一个空白行可以打破完全地项目

3) 给出的链接 :我不能评论还没有,但如果你给我一个链接以查看错误,我会是帮助您的到来。



Answer 2:

虽然从本地服务器迁移WordPress站点到Live服务器。 还有,我们需要考虑以下的步骤:

  1. 数据库配置是在WP-config.php文件
  2. 网站网址 :如果您正在开发woocommerce网站,然后手动,我们可以在整个数据库更改网站的网址。 所以有更好的解决方案, 搜索和替换脚本。 为了避免404的问题。
  3. 将这个脚本在根文件夹和新的网址取代旧的URL。


文章来源: wordpress site work on local but not works on online server