Welcome Guest, Not a member yet? Register   Sign In
How to display site homepage using http://localhost/ci instead of http://localhost/ci/welcome
#1

[eluser]developer86[/eluser]
Hello good people,

I am new to codeigniter and i'm urgently looking for help with loading a website homepage without entering any controller name in my URL input.

For example, when i enter http://localhost/ci/ in my web browser, i want to see the homepage (main page) loaded at http://localhost/ci/welcome but instead it returns all directories in the index of /ci. This is the problem i have and i've been trying hard to resolve it without any luck.

Currently, i'm able to successfully load the homepage URL with any of the options below:

http://localhost/ci/welcome
http://localhost/ci/welcome/index
http://localhost/ci/index.php


Please refer to the steps below that i took to remove index.php from my URLs

1. Config file (application/config/config.php) edited to show the following;

Code:
$config['base_url'] = '';
Code:
$config['index_page'] = '';

2. application/config/routes.php still points to welcome controller

Code:
$route['default_controller'] = "welcome";

3. created a .htaccess file with the following rules;

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ci/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|css|images|robots\.txt)
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>


Please help me fix this


Messages In This Thread
How to display site homepage using http://localhost/ci instead of http://localhost/ci/welcome - by El Forum - 12-22-2013, 04:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB