Welcome Guest, Not a member yet? Register   Sign In
htaccess configuration fails, tried other threads...
#1

[eluser]Medikal[/eluser]
I've looked at all the threads related to this using CodeIgniter 2.0, and I can't seem to get it to work, after adding the .htaccess from the wiki: http://codeigniter.com/wiki/mod_rewrite/

My config file important config options are like so:
Code:
$config['base_url']    = 'http://mybaseurl.com/subfolder/';

$config['index_page'] = "";

$config['uri_protocol']    = "QUERY_STRING";

My default controller in routes is welcome, if I go to:
mybaseurl.com/subfolder - I get the welcome view
mybaseurl.com/home - (A new controller that exists, I get 404)
mybaseurl.com/index.php/home - (I get the welcome controller)


Any ideas guys?

Thanks, I appreciate it.
#2

[eluser]Jaketoolson[/eluser]
Paste your .htaccess contents.
#3

[eluser]Medikal[/eluser]
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #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
    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>
#4

[eluser]Jaketoolson[/eluser]
wait, change your base_url

Code:
//from
$config['base_url']    = 'http://mybaseurl.com/subfolder/';
//to
$config['base_url']    = 'http://mybaseurl.com';
base_url is NOT your default controller, but your base www url. If you want to setup the default controller that is to be loaded, its in your routes.php file:
Code:
$route['default_controller'] = 'controller_name';
#5

[eluser]Medikal[/eluser]
Works, epic fail on my part. Thanks mate!




Theme © iAndrew 2016 - Forum software by © MyBB