当前位置: 首页 > 知识库问答 >
问题:

在codeigniter中未找到请求

袁枫涟
2023-03-14

我正在使用codeigniter开发一个web应用程序。

我有个问题

当我这样要求控制器的时候

http://localhost:8080/Saffron/Product/137/test-text

一切都很好,但当我这样要求控制器时

http://localhost:8080/Saffron/Product/137/مهارت-های-آموزشی-در مطالعه

得到了这个错误

The requested URL /Saffron/Product/137/کتاب-غلبه-بر-اضطراب-در-محیط-های-آموزشی was not found on this server.

我用这个htaccess规则

Options -Indexes -MultiViews +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Saffron/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php? [L]
</IfModule>

它工作在服务器上没有错误我有这个问题在wamplocahost.where问题是什么?

我终于找到了:

重写引擎在
重写 /Saffron/
重写规则^index\. php$-[L]
重写康德%{REQUEST_FILENAME}!-f
重写康德%{REQUEST_FILENAME}!-d
重写规则。/Saffron/index.php[L]

干得好

共有2个答案

能向晨
2023-03-14

您可以将这样的内容添加到路由器文件Application/config/routes.php

##################################################################################################################

我假设Saffron是您的base_url目录。

有关更多信息,请查看以下内容:

CI URI路由文档

尉迟高澹
2023-03-14

转到你的配置替换$config['base_url'] = ''; 下面的代码它将如何帮助你

if( (php_sapi_name() == 'cli') or defined('STDIN') )
{
    $config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
    $config['base_url'] .= "://". (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '127.0.0.1');
}
else
{
    $config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
    $config['base_url'] .= "://". (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '127.0.0.1');
    $config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
}

$config['secure_base_url'] = ((isset($_SERVER['SERVER_NAME'])) ? "https://".$_SERVER['SERVER_NAME'] : '');
$config['secure_base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

用于htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /folder name of your webapp/

    #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 ^(.*)$ /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>
 类似资料:
  • 大家好,我需要一个解决方案laravel项目,当我尝试打开后端管理与 /control它给我一个错误"未找到-请求的资源 /control未在该服务器上找到。" 当我将名称"/Control"更改为"/Control5"或类似的东西时,它的工作正常,但问题是我使用 /control视图和其他!我是新来的laravel我不知道是什么问题?请帮我解决这个问题! 网状物php 仪表板控制器

  • 我是CI新手,我尝试使用普通的HMTL文件作为模板。因此,我在“应用程序/视图”中创建了一个名为“教育”的文件夹。我头球得分。php,导航。php,内容。php和页脚。php文件。在我写的控制器里 然后我像“http://localhost:8080/mvc/index.php/education/”一样访问了链接 但是样式表没有附加,它与文件位于同一文件夹中。我还尝试将样式表链接的href改为“

  • 问题内容: 我的科尔多瓦版本是 5.0.0 将应用程序部署在设备上时,对于所有ajax请求都收到404错误。在网络浏览器上,它可以正常工作,但是在设备上部署时,相同的应用程序无法正常工作。 我尝试添加关注者来解决该问题,但没有帮助。 Config.xml AndriodManiest.xml 我还在index.html文件中添加了以下内容,但也没有任何区别。 这里的任何人还有另一个解决此问题的技巧

  • 我正在尝试将我的Laravel5项目上传到Apache/2.4上。xxx的7(Ubuntu)服务器。xx。x、 xx端口80。 当我浏览我的网站使用xxx.xx.x.xx/project/public,着陆页工作正常。 但是当我试图登录时,它抛出了这个错误, 请求的URL为xxx。xx。x、 在此服务器上找不到xx/project/public/auth/login。 但是当我尝试这个xxx的时候

  • 问题内容: 我想在jQuery的更改事件上在服务器上上传图像,但是使用codeigniter csrf我只能上传一次图像。如何使用Ajax上传图像以进行多个请求。设置此功能时请注意 那么我能够发送多个请求jQuery onchange事件,但是当csrf_protection将为false时,我认为csrf没有任何优势。所以问题是启用csrf_protection时如何使用ajax发送多个请求。我