【问题标题】:php-Codeigniter url not found找不到php-Codeigniter url
【发布时间】:2016-11-20 18:43:21
【问题描述】:

我在 /htdocs/trunk 文件夹中有一个项目。主干内存在 Codeigniter 文件夹结构,例如“应用程序”、“系统”等。下面是 /htdocs/trunk/application 中的 .htaccess 文件:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

下面是我的config.php:

$config['base_url'] = 'http://localhost/trunk/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';  

当我在浏览器中打开上面的基本 url 时,我成功获得了我的登录页面。但是,当我单击调用控制器功能的锚链接时,我得到 403 Forbidden。以下是路线、视图和错误:-

routes.php

$route['default_controller'] = "chomecontroller";
$route['search'] = "csearchentrycontroller";
$route['search/(:any)'] = "csearchentrycontroller/$1";

查看

<a href="<? echo base_url();?>search/searchEntry/4/1"> Redirect here </a>  

错误

You don't have permission to access /trunk/< on this server.  

任何帮助将不胜感激。谢谢

【问题讨论】:

    标签: php apache .htaccess codeigniter


    【解决方案1】:

    我想你会跳过 URL 之间的 index.php。 请在 URL 之间包含 index.php 并检查其是否有效。

    例如:http://localhost:90/codeigniter_captcha/index.php/{controller_name}。

    之后,如果您想在 URL 之间跳过 index.php,请在配置文件中更改它。

    【讨论】:

      猜你喜欢
      • 2016-10-29
      • 2015-01-25
      • 2016-06-19
      • 2017-10-05
      • 2015-08-29
      • 2013-03-27
      • 1970-01-01
      • 2013-12-28
      • 1970-01-01
      相关资源
      最近更新 更多