【问题标题】:Codeigniter htaccess not working on godaddy?Codeigniter htaccess 不能在 Godaddy 上工作?
【发布时间】:2015-08-11 21:04:01
【问题描述】:

我最近搬到了 godaddy Linux 托管,但 .htaccess 似乎不起作用。是否需要为 godaddy 进行任何设置,因为 .htaccess 正在本地 xampp 服务器和 hostek 服务器上工作。我收到“404 Not Found”错误消息。我正在使用 CodeIgniter-2.2.1 框架,我也有检查 php.ini 文件中加载模块中的 mod_rewrite 未找到从服务器端启用。

我的 htaccess 文件位于部署我的应用程序的根目录中。

RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

请提出建议。

【问题讨论】:

  • 登陆页面也显示404错误??
  • 我已经尝试过给出关于堆栈溢出的讨论解决方案,但它对我不起作用。所以我分享了我的应用程序设置和 httaccess 以找出问题。
  • @Girish:是的,请您查看网址:eyebrowze.com
  • @SameekMishra 检查下面的答案

标签: .htaccess codeigniter codeigniter-2


【解决方案1】:

使用这个

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

在 config.php 中

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

编辑 01

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

【讨论】:

【解决方案2】:

改变你的

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

喜欢

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

【讨论】:

    【解决方案3】:

    在 Godaddy 上工作的一个分享:

    RewriteEngine on
    RewriteBase /
    Options -Indexes
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/\?$1 [L]
    

    【讨论】:

      【解决方案4】:

      这对我有用:

      RewriteEngine On
      RewriteCond $1 !^(index\.php|resources|robots\.txt)
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
      

      【讨论】:

        【解决方案5】:
        <ifmodule mod_rewrite.c>
        
          # !IMPORTANT! Set your RewriteBase here and don't forget trailing     and leading
          #  slashes.
          # If your page resides at
          #  http://www.example.com/mypage/test1
          # then use
          # RewriteBase /mypage/test1/
        
        RewriteEngine on
        RewriteCond $1 !^(index\.php|resources|robots\.txt)
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /path_to/your_website/index.php?$1 [L,QSA] 
        </IfModule>
        

        【讨论】:

        • 这里的xml标签不区分大小写吗?
        猜你喜欢
        • 2014-12-21
        • 2016-03-01
        • 2012-04-29
        • 1970-01-01
        • 1970-01-01
        • 2013-03-23
        • 2016-05-09
        • 2011-05-29
        • 2015-12-16
        相关资源
        最近更新 更多