help with htaccess - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: help with htaccess (/showthread.php?tid=7207) |
help with htaccess - El Forum - 03-29-2008 [eluser]Unknown[/eluser] Hello, I'm not too good with the apache Rewrite engine, i would need a little help with it, I would need a htaccess that redirects the www to none www like http://www.domain.com to http://domain.com also if the request is the / (http://domain.com/) it redirects it to /main/index (http://domain.com/main/index) but if the request is anything other than / it leaves it as it is... If someone can help me with this I would really apreciate it... Thanks and Regards help with htaccess - El Forum - 03-29-2008 [eluser]m4rw3r[/eluser] You want to have /main/index as the default controller(/method)? If so, change the default_controller in config/routes.php Example: Code: $route['default_controller'] = "main"; Dunno about the removal of www. , may I ask why you need it? help with htaccess - El Forum - 03-29-2008 [eluser]Unknown[/eluser] the none-www is a SEO think, i dont whant multiple URL for the site... i know how to set the default controller and the default function for it, but i need that all the requests to the web root / to be redirected to /main/index with a 301 header help with htaccess - El Forum - 03-29-2008 [eluser]Pascal Kriete[/eluser] To remove the www: Code: RewriteEngine On To redirect to /main/index from / only: Code: RewriteRule ^/ /main/index [R=301,L] Put them in that order so that the www is removed first. |