How can I canonize my site? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How can I canonize my site? (/showthread.php?tid=25888) |
How can I canonize my site? - El Forum - 12-29-2009 [eluser]1234qwer[/eluser] hello. My site is pure code igniter but I`m having problems with canonization, since the home page can be accessed in several ways, for example: www.site.com www.site.com/ www.site.com/index.php site.com etc But other more is: www.site.com/index.php/banano/index/ And I want only one way to access the home page, and must be http://www.site.com/ and I want all other urls must be redirected to this one. Then I found this page with very good information (in spanish) Url Canónicas Then my actual .htaccess is that: Code: RewriteEngine on Code: Options +Indexes this fix the problem and all non www urls are being redirected to the www url, but now when i type: http://www.site.com/ it is redirected to http://www.site.com/index.php/banano/index/ and I won´t that. Can you help me with that canonization issue? What I need is the home page only being accesible by http://www.site.com/ thanks How can I canonize my site? - El Forum - 12-29-2009 [eluser]richthegeek[/eluser] screw the htaccess, use routes Code: $routes['.*'] = "banano"; How can I canonize my site? - El Forum - 12-29-2009 [eluser]1234qwer[/eluser] Sorry I don`t understand your answer, I`m newie. Do I have to add this lines in the .htaccess? or what? thanks How can I canonize my site? - El Forum - 12-29-2009 [eluser]richthegeek[/eluser] http://ellislab.com/codeigniter/user-guide/general/routing.html How can I canonize my site? - El Forum - 12-29-2009 [eluser]1234qwer[/eluser] Then I can`t do it in the .htaccess? I need code the application/config/routes.php archive? and only add this line. $routes['.*'] = "banano"; $routes['default_controller'] = 'home'; Right? How can I canonize my site? - El Forum - 12-29-2009 [eluser]richthegeek[/eluser] you *could* do it in htaccess but its sooooooooo much easier doing in the routes.php file. How can I canonize my site? - El Forum - 12-29-2009 [eluser]Johan André[/eluser] Codeigniter is setup to make seo-urls. You use .htaccess to remove index.php if it bothers you. All other work (well almost) is done with uri routing. Read the userguide and it will become clear to you. |