在godaddy服务器前端不在CodeIgniter中工作

时间:2015-05-20 10:11:47

标签: php .htaccess codeigniter routes server

后端工作正常,但前端只有默认控制器工作,如果我调用默认控制器写控制器和功能名称然后它不工作

  

(在此服务器上找不到404错误“indialive_today / home /。”)

for (FSSVGPathElement* path in _svg.paths) { // Make the map fits inside the frame float scaleHorizontal = self.frame.size.width / _svg.bounds.size.width; float scaleVertical = self.frame.size.height / _svg.bounds.size.height; float scale = MIN(scaleHorizontal, scaleVertical); CGAffineTransform scaleTransform = CGAffineTransformIdentity; scaleTransform = CGAffineTransformMakeScale(scale, scale); scaleTransform = CGAffineTransformTranslate(scaleTransform,-_svg.bounds.origin.x, -_svg.bounds.origin.y); UIBezierPath* scaled = [path.path copy]; [scaled applyTransform:scaleTransform]; CAShapeLayer *shapeLayer = [CAShapeLayer layer]; shapeLayer.path = scaled.CGPath; [self.layer addSublayer:shapeLayer]; [_scaledPaths addObject:scaled]; }

.htaccess

routes.php文件

  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /demo/indialive_today
    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ admin/index.php?/$1 [L]
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    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>
    # 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>

2 个答案:

答案 0 :(得分:0)

试试这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

来自帖子:https://stackoverflow.com/questions/17330398/codeigniter-and-godaddy-default-controller-issues

答案 1 :(得分:0)

在您的档案中,您有:

RewriteRule ^(.*)$ index.php?/$1 [L]

看问号?这意味着您将请求传递给查询字符串(QUERY_STRING)。但是,您正在检查请求URI(REQUEST_URI)。

因此,首先,您需要将该行更改为:

RewriteRule ^(.*)$ index.php/$1 [L]

更好的选择是:

RewriteRule ^ index.php [L]

您还需要向RewriteBase添加正斜杠:

RewriteBase /thinksoft/demo/indialive_today/

经过一些优化后,您的文件(应存在于/thinksoft/demo/indialive_today/目录中)应如下所示:

<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

    # If you are using Apache 2.4.4 and later you can uncomment
    # the line below, which is a decent alternative for using
    # mod_rewrite
    # FallbackResource /thinksoft/demo/indialive_today/index.php
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /thinksoft/demo/indialive_today/

    # Removes access to the system folder by users.
    # Additionally this will allow you to create a System.php controller,
    # previously this would not have been possible.
    # 'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ admin/index.php/$1 [L]

    # When your application folder isn't in the system folder
    # This snippet prevents user access to the application folder
    # Submitted by: Fabdrol
    # Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    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]
    # or use the following as a replacement to the rule above:
    # RewriteRule ^ index.php [L]
</IfModule>

注意:我还添加了FallbackResource选项(已注释掉),这非常有用。

还要确保您的CodeIgniter配置设置为使用REQUEST_URI而不是QUERY_STRING