0

My URL looks like this:

http://kanchannews.com/news/news-details/103/Top-5-Mind-Blowing-Facts-You-Know-
About-Samsung

What i want to show is like:

http://kanchannews.com/news/Top-5-Mind-Blowing-Facts-You-Know-About-Samsung

Can I get this kind of url using htaccess? I'm using codeigniter for this projects.

1
  • You could probably make your own or download a project from GIThub. Such as: murrion.com/2011/08/… Commented Jun 2, 2015 at 15:52

1 Answer 1

2

This will be done, with CI Routes. The problem you'll have is not having the ID of the post in your URL. If the title is also unique, you'll be fine.

$route['news/(:any)'] = 'news/news_by_title/$1';

This will re-route everything to a "news_by_title" method within your news controller, which you'll need to query the database using the title.

http://www.codeigniter.com/userguide3/general/routing.html

Sign up to request clarification or add additional context in comments.

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.