Php 在Codeigniter HMVC项目中以标准方式管理URL
我已经在codeigniter HMVC中开发了这个项目,现在我想用标准的方式管理URL 我当前的URL:Php 在Codeigniter HMVC项目中以标准方式管理URL,php,codeigniter,codeigniter-2,codeigniter-3,Php,Codeigniter,Codeigniter 2,Codeigniter 3,我已经在codeigniter HMVC中开发了这个项目,现在我想用标准的方式管理URL 我当前的URL: http://xyz/home/contactus http://xyz/home/aboutus .... .... http://xyz/contactus http://xyz/aboutus .... .... 我想要的就像: http://xyz/home/contactus http://xyz/home/aboutus .... .... http://xyz/cont
http://xyz/home/contactus
http://xyz/home/aboutus
....
....
http://xyz/contactus
http://xyz/aboutus
....
....
我想要的就像:
http://xyz/home/contactus
http://xyz/home/aboutus
....
....
http://xyz/contactus
http://xyz/aboutus
....
....
我使用的是HMVC codeigniter结构。在ur route.php文件中,你可以像这样重定向
$route['xyz/contactus'] = "xyz/home/contactus";
可以在中定义自定义管线 在URL中调用
xyz/联系我们“
,这将很好地工作
从
[项目文件夹]/application/config/routes.php
要将URI路由为虚拟控制器和虚拟方法,可以使用选项Route。路由URI的主要用途是使url美观,并停止显示用户主控制器&路由可以提供方法名
语法
$route['dummy-controller/dummy method']='main_controller/main_method'代码>
示例
$route['contact-us']='index.php/home/contactus'代码>是代码点火器2还是3?也可以在我提到的URL中看到,“xyz”将是域名。。我正在使用CI的HMVC结构。。我试过$路线['contact-us']=“home/home/contactus”;&我也试过$路由['contact-us']=“home/contactus”;但是它不工作吗?我可以看看你的routes.php
文件吗?这样,我可以帮你解决这个问题$路由['404_覆盖']=''$路由['translate_uri_dashes']=FALSE$路由['contact-us']=“home/home/contactus”;所有最好的@Amitain我提到的URL,“xyz”将是域名。。我正在使用CI的HMVC结构。。我试过$路线['contact-us']=“home/home/contactus”;&我也试过$路由['contact-us']=“home/contactus”;但是它不起作用了吗?xyz.com/home/contactus
会进入你的页面吗?$route['contact-us']=“home/contactus”代码>这应该可以在MVC结构中使用f9,但在HMVC结构中不适用。。有什么想法吗?让我们看看。在我提到的URL中,“xyz”将是域名。。我正在使用CI的HMVC结构。。我试过$路线['contact-us']=“home/home/contactus”;&我也试过$路由['contact-us']=“home/contactus”;但它不起作用?