是否可以使用不同的网址显示同一页面? [英] Is it possible to show same page with different url?
问题描述
我想为不同的URL显示相同的内容.例如:
I want to show same content for different URL. For example:
website.com/controllername/country/state1/dist1/
website.com/controllername/country/state2/dist2/
我希望这两个URL显示相同的内容.即使某些内容会因URL而异(例如州名和地区名).我不想为每个URL创建单独的内容/页面.我想知道是否有可能在Codeigniter中这样做吗?并可以在Codeigniter中显示如上的URL?
I want these two URL to show same content.Even though the some content will vary based on URL (like name of state and district). I don't want to create separate content/page for every URL. I want to know if its possible to do so in Codeigniter? and is it possible to show a URL like the above in Codeigniter?
推荐答案
是的,使用Codeigniter路由是可能的,
Yes it is possible with Codeigniter routing,
在您的 application/config/routes.php
中粘贴以下代码,并更改您使用的控制器和函数名称,
In your application/config/routes.php
paste the below code and change the controller and function name you used,
$ route ['([a-zA-Z0-9 ---_%])+/([a-zA-Z0-9 ---_%])+/([a-zA-Z0-9 ---__%])'] ='您的控制器名称/您的功能名称/$ 1/$ 1/$ 1';
这篇关于是否可以使用不同的网址显示同一页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!