Welcome Guest, Not a member yet? Register   Sign In
CI mod rewrite not working (noob question)
#1

[eluser]chaminda[/eluser]
Guys, I've started using CI from yesterday Smile

So here is the problem. i can't get rid of the index.php part of the url.

*WORKING
Code:
http://localhost/LoginSystem/index.php/user

*NOT WORKING
Code:
http://localhost/LoginSystem/user
#2

[eluser]chaminda[/eluser]
* CI deploy path along with the .htacess
Code:
C:\wamp\www\LoginSystem



*Here is the .htacess file
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /LoginSystem/

    #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]
    RewriteRule ^(.*)$ /LoginSystem/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>
#3

[eluser]chaminda[/eluser]
*Other things to note

1. "LoadModule rewrite_module modules/mod_rewrite.so" have uncommented in the httpd.conf

2. Directory have following things in the httpd.conf
Code:
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

3. $config['uri_protocol']= 'REQUEST_URI'; has been set.

4. Here is a part from httpd.conf

Quote:# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "c:/wamp/www/"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory>
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "c:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all

#
# Controls who can get stuff from this server.
#

# onlineoffline tag - don't remove
Order Allow,Deny
Allow from all

</Directory>




Theme © iAndrew 2016 - Forum software by © MyBB