【问题标题】:404 error when redirection to a link codeigniter重定向到链接 codeigniter 时出现 404 错误
【发布时间】:2014-01-03 02:48:54
【问题描述】:

我在我的实时服务器中托管了一个站点进行测试。但是我使用代码来访问我系统中的特定控制器。它在我的本地主机中运行良好,但在我的实时服务器中它不起作用

网址如下

在本地

本地主机:55/axxxx

b 69.1xx.xxx.xxx/~用户名/axxxx/axxxx

使用 a 调用控制器时效果很好,但是使用 b 调用控制器时出现 404 错误

这是我的 co`index.php/Authenticaton/authenticate">

                <p>
                    <label for="login">Username</label>
                    <input type="text" name="username" placeholder="Username or email" required>
                </p>
                <p>
                    <label for="password">Password</label>
                    <input type="password" name='password' placeholder="Password" required> 
                </p>

                <p>
                    <input type="submit" name="submit"   id="login"  class="btn-1" value="Continue">
                </p>       
            </form>`

请在这种情况下帮助我

对不起英语不好

提前致谢

【问题讨论】:

  • 请发布您的代码。
  • 更多细节会有所帮助,但您可以先检查您的 application/config/config.php 文件,看看您是否使用了正确的基本 URL。

标签: codeigniter


【解决方案1】:

将 index.php 放在控制器名称之前是否有效,如果可以,请查看您的 htaccess。这可能有效:

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

可能是 base_url 指向不同的位置。 用这个代替 base_url:

 $root  = "http://".$_SERVER['HTTP_HOST'];
 $root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
 $config['base_url']    = "$root";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-23
    • 2013-05-05
    • 2018-05-09
    • 1970-01-01
    • 2015-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多