How do I change a URL for?

How to give 301 redirect to change old url to new url in PHP CodeIgniter?

  • I want to redirect http://www.example.com/contact_form to http://www.example.com/contact-form. contact_form is controller name.. need to replace underscore with hyphen so as to make the URL SEO friendly..

  • Answer:

    Add this to your routes.php $routes['contact-form'] = 'contact_form'; Go check out the defining routes in the user guide. It basically maps the URL of contact-form to your controller that named contact_form. That is just the basic, you can do more.

Kong Jin Jie at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.