如何调用codeigniter控制器功能,而不URL,而不指数 [英] How to Call codeigniter controller function without url without index

查看:159
本文介绍了如何调用codeigniter控制器功能,而不URL,而不指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要调用codeigniter控制器类功能筛选。但这不是工作
我想删除网址的index.php

I want to call codeigniter controller class function Like this. but this is not working i want remove index.php from URL

使用的index.php这方面的工作以及如何从URL删除的index.php?

With index.php this working well How to Remove index.php from url ?

我改变了

   $config['index_page'] = 'index.php'; 

   $config['index_page'] = '';   

但它没有工作。

推荐答案

您必须做两份工作,除去从URL indx.php。

You have to do two job to remove the indx.php from the URL.

第一份工作 -

修改配置文件

 $config['index_page'] = 'index.php'; 

 $config['index_page'] = ''; 

(你已经做了)

第二份作业 -

您必须添加.htaccess文件在你的根目录下,并确保你的PHP的mod_rewrite启用。

You have to add a .htaccess file in your root directory and make sure that your php mod_rewrite is enabled.

RewriteEngine on
RewriteRule ^([a-z0-9_-]+)\.html$ index.php/page/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|asset|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

刚刚尝试这一点。希望它的工作原理,让我知道怎么回事。

Just try this. Hope it works and let me know whats going on.

这篇关于如何调用codeigniter控制器功能,而不URL,而不指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆