Call controller based on subdomain? |
[eluser]TommyHot[/eluser]
Hi, standard CI url in my example looks like http://www.server.com/controller/method/...ubcategory and I would like to create this kind of structure: http://category.server.com/controller/me...ubcategory (e.g. http://pc.server.com/items/view/motherboards which would display all motherboards from category PC) I have set up wildcard dns for my domain, but have no idea how to set up .htaccess file. I've used many examples from internet but none worked for me.. Either i was getting CI 404, or default controller. Can you please help me?
[eluser]mi6crazyheart[/eluser]
According to CI url structure , if the url is like this: http://www.server.com/controller/method/...ubcategory Then, at here after METHOD.. "category" is the 1st uri segment & "subcategory" is the 2nd uri segment. As the using of URI segment depend upon u'r necessity u can use 1 or 2 uri parameter. So, if u want u'r url should be like this: http://category.server.com/controller/me...ubcategory Means, u want use one URI segment(subcategory) then u can just use this as it is now. No need to change at any place.
[eluser]TommyHot[/eluser]
well I understand it now.. even if I access http://whatever.server.com/controller/me...ubcategory it will still load controller and its method no matter what subdomain I use. Thank you! |
Welcome Guest, Not a member yet? Register Sign In |