CodeIgniter redirect problem |
[eluser]Aerospace[/eluser]
When I go to http://www.hassanc.co.uk/home/ I get a 404 error. How can I make it so it redirects to http://www.hassanc.co.uk/home/index/ automatically? Is it something to do with the .htaccess file? Thanks for your help.
[eluser]cahva[/eluser]
Userguide is your friend: http://ellislab.com/codeigniter/user-gui.../urls.html
[eluser]Aerospace[/eluser]
I've done that already, index.php is removed from the URL, which is great. But I want it to go to www.hassanc.co.uk/home/index automatically when someone visits my CodeIgniter root installation (www.hassanc.co.uk/home). Thanks
[eluser]Suhas nazir[/eluser]
Hey u can simply remove index.php from ur url by using the following code.Copy the code and save it as .htaccess.Now u go to config.php and change it as $config['index_page'] = ""; RewriteEngine On RewriteCond %{REQUEST_URI} ^/system.* RewriteRule ^(.*)$ index.php?/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ index.php?/$1 [L]
[eluser]Georgi Budinov[/eluser]
Guys he wants something else ... He managed to remove the index.php already ... @Aerospace Paste this in the constructor of your home controller and should be ok Code: if($this->uri->total_segments()==1)
[eluser]Aerospace[/eluser]
[quote author="Georgi Budinov" date="1281731258"]Guys he wants something else ... He managed to remove the index.php already ... @Aerospace Paste this in the constructor of your home controller and should be ok Code: if($this->uri->total_segments()==1) Now it goes to http://www.hassanc.co.uk/home/index/index I'm thinking about moving CodeIgniter to the root and then making a function called home() instead But thanks for your help anyway
[eluser]Aerospace[/eluser]
Yes! I got it to work by defining the default controller as 'index' in config/routes.php How do I mark this thread as 'solved'? |
Welcome Guest, Not a member yet? Register Sign In |