[英]wordpress site work on local but not works on online server
my wordpress site correctly working on local server but when i am uploading it on server 404 page not found error is showing. 我的wordpress网站在本地服务器上正常工作,但是当我在服务器404页面上将其上传时,未找到错误。
i check my index.php its correctly redirecting. 我检查我的index.php正确重定向。 here is code:- 这是代码:-
<?php
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
?>
i check my wp-blog-header.php,its also working.because i forward it to phpinfo page and info page showing,but site page not showing. 我检查了我的wp-blog-header.php,它也可以正常工作。因为我将其转发到了phpinfo页面和info页面,但没有显示网站页面。 here is wp-blog-header code:- 这是wp-blog-header代码:-
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' );
}
?>
and my temp-loader.php is:- 而我的temp-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;
?>
and my htaccess file is:- 我的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 tell me how i run my site online. 请告诉我我如何在线运行我的网站。
This is a really frustrating problem when using WordPress indeed. 当确实使用WordPress时,这确实是一个令人沮丧的问题。 But I'll try to share some experiences I had. 但我会尝试分享一些经验。
0) Enable debugging mode : In wp-config.com change WP_DEBUG to TRUE and add the following lines: 0) 启用调试模式 :在wp-config.com中,将WP_DEBUG更改为TRUE并添加以下几行:
error_reporting(E_ALL);
ini_set('display_errors', true);
With this, we'll have WP showing up more errors than we want ;) 有了这个,我们将让WP显示比我们想要的更多的错误;)
tip: use it in local machine to make a bulletproof plugin/theme/project 提示:在本地计算机上使用它来制作防弹插件/主题/项目
1) Check if the 404 is from the default browser or from wordpress : Try to access wp-admin url. 1) 检查404是来自默认浏览器还是来自wordpress :尝试访问wp-admin网址。 This is a good way to check if the domain is properly set. 这是检查域设置是否正确的好方法。 Sometimes the error is that index.php is not being found, so, we need to load something that will not care for the plugins and themes, that's the reason I suggest to use the wp-admin. 有时错误是找不到index.php,因此,我们需要加载一些与插件和主题无关的东西,这就是我建议使用wp-admin的原因。
tip: Even a theme-less install, will have the wp-admin working 提示:即使没有主题的安装,也可以使用wp-admin
2) Remove anything that can be the problem : If we can't find exactly what's wrong on previous steps, we need to get dirty: rename the THEMES and PLUGINS folders to ensure that the problem isn't any of the plugins. 2) 删除可能存在问题的所有内容 :如果在上一步中找不到确切的问题,则需要弄清楚:重命名THEMES和PLUGINS文件夹,以确保问题不出在任何插件上。
tip: sometimes a blank line in the beginning of a plugin file can break completly your project 提示:有时,插件文件开头的空白行会完全破坏您的项目
3) Give a link : I can't comment yet, but I'll be glad on helping you if you send me a link to see the error. 3)提供一个链接 :我还不能发表评论,但是如果您向我发送链接以查看错误,我们将很乐意为您提供帮助。
While migrating wordpress site from local server to Live server. 将wordpress网站从本地服务器迁移到实时服务器时。 There are following steps we need to take into account: 我们需要考虑以下步骤:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.