0

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?

2 Answers 2

6

You should definitely check out the URI Routing.

In your case:

$route['deals'] = "main/home/promotion/deals";
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.