如何更改codelginter中的url [英] How to change the url in codelginter

查看:299
本文介绍了如何更改codelginter中的url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网址是 http://mydomain.com/controllername/method/

现在我需要的网站url喜欢。
http://mydomain.com/method

Now I need the site url like. http://mydomain.com/method.

mydomain名称想要作为控制器名称访问。例如
。网址像
www.testing.com/pages。 'test'作为codeigniter中的控制器。

mydomain name wants to access as a controller name . for example. url like www.testing.com/pages. 'testing' act as a controller in codeigniter.

解释如何从域名获取控制器名称。以及如何从url中删除控制器名称(www.mydomain.com/controllername/method)。

Explain how to get the controller name from the domain name. and also how to remove the controller name(www.mydomain.com/controllername/method) from the url.

我需要的URL如www.controllername.com/method

I need the url like www.controllername.com/method

推荐答案

在application / config / routes.php中使用此代码

In application/config/routes.php use this code

$route['method'] = 'controllername/method';

这篇关于如何更改codelginter中的url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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