Change url help |
[eluser]TechCadre[/eluser]
I recently picked up a client and the client wants the url changed and I need help with doing this. If my site was called http://www.site.com/about_us/ but now i want it to say http://www.site.com/customers/ Any help?
[eluser]WanWizard[/eluser]
Assuming that this site would be a standard CodeIgniter site, there should be a controller called 'about_us' in the application controllers directory. Renaming it, and modifying the class and constructor name in it should be enough to make your client happy...
[eluser]TechCadre[/eluser]
This is what is under the about_us.php in controllers Code: <?php What should I change?
[eluser]steelaz[/eluser]
Try Code: <?php Not sure about $data['section'] = "AboutUs"; it may be used internally somewhere.
[eluser]TechCadre[/eluser]
So far this has not worked... anything I could do?
[eluser]theprodigy[/eluser]
you may need to change the link in the views. If it points to About_us, you need to change it to point to Customers (as well as changing the name and constructor of the class). It's also worth a look at the config/routes.php file to see what the default controller is set to.
[eluser]erik.brannstrom[/eluser]
Renaming is probably the best alternative for a small application, though theprodigy mentions the config/routes.php file. How about just adding $route['customers'] = "about_us"; to that file? It's just another option, which also should do the trick.
[eluser]TechCadre[/eluser]
[quote author="theprodigy" date="1273025231"]you may need to change the link in the views. If it points to About_us, you need to change it to point to Customers (as well as changing the name and constructor of the class). It's also worth a look at the config/routes.php file to see what the default controller is set to.[/quote] I tried the config/routes.php thing but it did nothing. As I am new to this can you explain to me what you mean by "changing name and constructor of the class"?
[eluser]theprodigy[/eluser]
[quote author="TechCadre" date="1273027266"][quote author="theprodigy" date="1273025231"]you may need to change the link in the views. If it points to About_us, you need to change it to point to Customers (as well as changing the name and constructor of the class). It's also worth a look at the config/routes.php file to see what the default controller is set to.[/quote] I tried the config/routes.php thing but it did nothing. As I am new to this can you explain to me what you mean by "changing name and constructor of the class"?[/quote] What I meant was what was explained up above (by steelaz). Your controller needs to change from Code: <?php Code: <?php Notice your class name and constructor are changed from About_us to Customers. Also, the first part I was talking about was the links that point you to the page in question. If they are linking to (using your example) http://www.site.com/about_us/ then they need to change to http://www.site.com/customers/. The links may be in the form of Code: echo anchor('about_us'); Code: echo anchor('customers'); If you go with this change, there should be no reason to alter config/routes.php unless the default_controller is set to about_us |
Welcome Guest, Not a member yet? Register Sign In |