我已将我的codeigniter项目和所有相关数据库从旧服务器(Centos 5.11)移至新服务器(Centos 6.7)。在旧服务器中,已经在.htacess文件和其他更改的帮助下处理了从URL中删除index.php的任务。我已将整个项目移动到新服务器上而不进行任何更改。当我访问项目的主页面,即登录页面时,它工作正常并显示没有任何问题。但是当我登录的那一刻,我得到一个404错误页面。但是当我在所需的地方添加index.php片段时它就可以工作了!将项目移动到最新的服务器版本会导致问题吗?
答案 0 :(得分:0)
<!-- Including Header -->
<?php get_header(); ?>
<!-- Post Cover -->
<div id="postCover" class="container-fluid"></div>
<div id="postContainer" class="container">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
<?php the_title(); ?>
</div>
<div class="panel-body">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('post-thumbnail', array( 'class' => "img-responsive"));
}
?>
<div id="posDetailsContainer" class="container-fluid text-left">
<span>
<i class="fa fa-calendar"></i>
Posted on <?php the_time('M'); ?> <?php the_time('j'); ?> <?php the_time('Y'); ?>
</span>
<span>
<i class="fa fa-comments-o"></i>
<?php comments_number( 'No Comments', '1 Comment', '% Comments' ); ?>
</span>
</div>
<!-- Post Content Display -->
<div id="postContent" class="container-fluid">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile;
endif;
?>
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
答案 1 :(得分:0)
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
#RewriteRule \.(jpe?g|gif|bmp|png)$ - [F]
</IfModule>
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
<IfModule mod_headers.c>
Header add Cache-Control: "no-store, no-cache, must-revalidate"
Header unset Pragma
FileETag None
Header unset ETag
</IfModule>
#End Gzip
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>