【问题标题】:Codeigniter application not working on app engine, showing 404Codeigniter 应用程序无法在应用程序引擎上运行,显示 404
【发布时间】:2014-01-10 10:59:53
【问题描述】:

我已经将我的网络应用上传到应用引擎,它一直显示 404。我已经尝试过这些配置。

$config['base_url'] = '';
$config['index_page'] = '';

| 'AUTO' 默认 - 自动检测 | 'PATH_INFO' 使用 PATH_INFO | 'QUERY_STRING' 使用 QUERY_STRING | 'REQUEST_URI' 使用 REQUEST_URI | 'ORIG_PATH_INFO' 使用 ORIG_PATH_INFO

我已经尝试了所有选项。

$config['uri_protocol'] = 'AUTO'; 

$route['default_controller'] = "home";
$route['404_override'] = '';

我的 .htaccess 文件

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>


<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

我的 app.yaml

application: xxxxxxxx
version: x
runtime: php
api_version: 1
threadsafe: false

handlers:
- url: /.*
  script: index.php

【问题讨论】:

  • 没有 .htaccess 和在你的 url 中使用 index.php 是否可以工作?
  • 我没试过。我不想在我的网址中使用 index.php
  • 我问只是看看问题出在 htaccess 中,还是在服务器设置中
  • 已解决,只是应用程序:xxxxxxxx 版本:x 运行时:php api_version:1 线程安全:错误处理程序:- url:.* 脚本:index.php
  • 我试过 url: .* 和 /.* 但没有任何效果。我的 index.php 脚本根本没有运行。它显示为 500 服务器响应。有什么想法吗?

标签: php .htaccess codeigniter google-app-engine


【解决方案1】:

以下设置适用于我在 WAMP Sever 上使用全新的 codeigniter v2.1.4 设置。

配置

$config['base_url']     = '';  
$config['index_page']   = '';
$config['uri_protocol'] = 'AUTO';  

HTACCESS

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /Codeigniter2.1.4/

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

【讨论】:

  • AppEngine 不/不能使用 htaccess 文件,因此这不是一个有用的答案。
猜你喜欢
  • 1970-01-01
  • 2014-10-31
  • 1970-01-01
  • 2014-01-13
  • 2020-11-22
  • 2011-04-26
  • 2011-12-11
  • 2021-03-02
  • 1970-01-01
相关资源
最近更新 更多