【问题标题】:Working codeigniter (xampp) won't work live - .htaccess or index.php?工作的 codeigniter (xampp) 无法实时工作 - .htaccess 或 index.php?
【发布时间】:2016-02-14 00:12:29
【问题描述】:

我正在为我的工作开展一个项目,现在尝试将其上线。

当我在 xampp 中运行我的项目时,它运行良好,但是当我在线运行它时,我在浏览器选项卡中看到“404”。这是我得到的回复:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keyword" content="">
    <link rel="shortcut icon" href="img/favicon.png">

    <title>404</title>

    <!-- Bootstrap core CSS -->
<!--    <link href="--><!--assets/bs3/css/bootstrap.min.css" rel="stylesheet">-->
    <link href="

所以它从我用于 a href 的 error_404.php 文件中的第一个 php 开始标记停止。

这是我在根目录中的 .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php/$1 [L]

BASEPATH 是:/var/www/vhosts/(domain_name).nl/(domain_name).eu/dashboard/system/ 我认为它必须是:(域名).eu/dashboard/system/ 还是我错了?

【问题讨论】:

标签: php .htaccess codeigniter


【解决方案1】:

我在这里找到了解决方案.. Unable to access codeigniter controller in Live Server but accessible in localhost (xampp on windows)

tnxs jah

我忘记了一些大写字母。对不起,伙计们..让我感到羞耻

【讨论】:

    【解决方案2】:

    尝试将其用作 .htaac​​ess:

     RewriteEngine on
    
     # enable the directives - assuming they're not enabled globally
     ExpiresActive on
    
     # send an Expires: header for each of these mimetypes (as defined by server)
     ExpiresByType image/png "access plus 1 month"
     ExpiresByType image/gif "access plus 1 month"
     ExpiresByType image/jpeg "access plus 1 month"
    
     # css may change a bit sometimes, so define shorter expiration
     ExpiresByType text/css "access plus 1 days"
    
    RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
    

    【讨论】:

      猜你喜欢
      • 2020-04-04
      • 2012-05-07
      • 2021-02-25
      • 2015-12-02
      • 2011-11-01
      • 2016-03-01
      • 2012-04-29
      • 2016-02-09
      • 2016-12-01
      相关资源
      最近更新 更多