【问题标题】:404 error codeigniter when upload on server在服务器上上传时出现 404 错误 codeigniter
【发布时间】:2016-11-13 04:37:50
【问题描述】:

当我点击 url https://www.domainname.com/welcome。它给了我 404 错误和

当我点击https://www.domainname.com/Welcome 时,它工作正常。我的控制器名称和文件名是大写字母,下面是我的 htaccess。

请告诉我哪里出错了。

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

提前致谢。

【问题讨论】:

  • 在我这边,两个链接都给出 404 状态。这些是真正的链接吗?

标签: javascript php .htaccess codeigniter


【解决方案1】:

我已从此链接获得解决方案。您可以在哪里找到类似的解决方案。

希望,这将有助于解决您的 404 错误。

Codeigniter throws 404 after uploading to server

【讨论】:

  • 解决方案,因为我的链接使用大写字母。
【解决方案2】:

你会尝试一次吗?

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

【讨论】:

    【解决方案3】:

    你可以使用它。
    在 config.php 中

    $config['base_url'] = 'your base url';
    $config['index_page'] = '';
    $config['uri_protocol'] = 'AUTO';
    $config['url_suffix'] = ''; 
    

    在 .htaccess 中(这应该放在应用程序文件夹之外)

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

    在 autoload.php 中

    $autoload['helper'] = array('url'); 
    

    【讨论】:

      【解决方案4】:

      使用“vhosts.conf”文件夹。 URL 可以区分大小写。位置:/var/www/vhosts/domain.com/conf/vhosts.conf

      重写引擎开启 rewritemap 小写 int:tolower RewriteCond $1 [A-Z] RewriteRule ^/(.*)$ /${小写:$1} [R=301,L]

      【讨论】:

        【解决方案5】:

        您必须在 config 文件夹中的 routes 页面 上为此创建路线。对于前-

         $route["welcome-page"] = 'Welcome';
        

        并调用您的页面 - https://www.domainname.com/welcome-page

        希望这段代码对你有所帮助。

        【讨论】:

          【解决方案6】:

          嗨,当它在本地工作时遇到了同样的问题,我上传到亚马逊 Ec2 服务器。 我得到的解决方案是:制作所有控制器和模式

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2016-05-10
            • 2016-07-30
            • 1970-01-01
            • 1970-01-01
            • 2018-09-16
            • 2016-07-10
            • 1970-01-01
            相关资源
            最近更新 更多