help with htaccess |
[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
[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?
[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
[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. |
Welcome Guest, Not a member yet? Register Sign In |