problem with URL on main page |
[eluser]smck87[/eluser]
Hello, when i open main page of my site using for example this url: http://mywebsite.com main page loads and i get this in address bar: http://mywebsite.com/controller-name/action-name but i need just http://mywebsite.com on my main page How can i do this?
[eluser]pickupman[/eluser]
This should happen by default. Are you using a redirect somewhere? Got some code to post for us to take a look at.
[eluser]smck87[/eluser]
Yes, this happens by default, but i want to get just address of website on my main page without additional 'controller/index'. My code is usual, nothing special, no redirects: Code: class Main extends Controller {
[eluser]pickupman[/eluser]
No, I meant when someone types in your domain http://example.com should not be changing to http://example.com/controller/index. It should just stay as http://example.com. Are you using .htaccess somewhere that could cause this? This should even happen when someone types in http://example.com/main. It should stay that way and load the index method since the 2nd segment is omitted.
[eluser]mi6crazyheart[/eluser]
[quote author="smck87" date="1281866737"]Yes, this happens by default, but i want to get just address of website on my main page without additional 'controller/index'. My code is usual, nothing special, no redirects: Code: class Main extends Controller { Hey!!!, i think u might've done some changes in u'r .htaccess file or in config.php file due to which it might have redirecting to "main.php" controller file rather than "Welcome.php" which is the default one...
[eluser]smck87[/eluser]
Yes, i have changed application\config\routes.php $route['default_controller'] = "main/index";
[eluser]mi6crazyheart[/eluser]
[quote author="smck87" date="1281831892"]Hello, when i open main page of my site using for example this url: http://mywebsite.com main page loads and i get this in address bar: http://mywebsite.com/controller-name/action-name but i need just http://mywebsite.com on my main page How can i do this?[/quote] if u need this then, is their any particular reason to make that changes in that "routes.php" file ? Because, without doing that changes also u can u can achieve what u've asked for by just : remove the changes which u've done in that "routes.php" file & open u'r VIEW folder and make necessary changes in that "welcome_message.php" file. Else, u can create a another view file & load that view file from u'r "welcome.php" controller...
[eluser]pickupman[/eluser]
The default controller should be simply Code: $route['default_controller'] = 'main'; Glad you got it figured out.
[eluser]smck87[/eluser]
[quote author="pickupman" date="1281980037"]The default controller should be simply Code: $route['default_controller'] = 'main'; Yes, right, but it produces 'main/index' in address bar, so seems like only $route['default_controller'] = 'welcome' works fine :-S |
Welcome Guest, Not a member yet? Register Sign In |