theGame
theGame

Reputation: 393

CodeIgniter minimizing length of URLs

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?

Upvotes: 0

Views: 659

Answers (2)

John Skoubourdis
John Skoubourdis

Reputation: 3259

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).

Upvotes: 1

Kriem
Kriem

Reputation: 8705

You should definitely check out the URI Routing.

In your case:

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

Upvotes: 6

Related Questions