开发者

CodeIgniter minimizing length of URLs

开发者 https://www.devze.com 2023-03-23 09:21 出处:网络
So, I am having a big time problem. I am using CodeIgniter. I have a website running that has a lot of pages, so URLs get too big and they look too bad. So what I want to do, is shorten my URLs. For

So, I am having a big time problem.

I am using CodeIgniter. I have a website running that has a lot of pages, so URLs get too big and they look too bad. So what I want to do, is shorten my URLs. For example:

www.abc.com/main/home/promotion/deals

I want to make something like this:

www.abc.com/deals

So my question is, How should I do this thing 开发者_运维问答in CodeIgniter? Is there a built in helper or library for handling my problem?


You should definitely check out the URI Routing.

In your case:

$route['deals'] = "main/home/promotion/deals";


Here is a good article if you want to actually change the URL length with a more automatic way:

http://www.web-and-development.com/codeigniter-minimize-url-and-remove-index-php/#removing-first-url-segment

I think there are lot of examples of the usage, so it is also like a small tutorial of how to use the routes of Codeigniter.

This is very useful especially if you are using dynamic content and the urls are automatically created (e.g. for SEO content and URLs created by your customer).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号