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 !

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

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

*NOT WORKING
Quote:http://localhost/LoginSystem/user



* My CI deploy path along with the .htacess
C:\wamp\www\LoginSystem

Here is a screenshot of my folder structure---->

View
#2

[eluser]chaminda[/eluser]
Here is the .htaccess 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. $config[‘uri_protocol’]= ‘REQUEST_URI’; has been set.

3. Directory have following things in the httpd.conf

Code:
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

4. Here is a part from httpd.conf

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

[eluser]chaminda[/eluser]
Any Help?
#5

[eluser]chaminda[/eluser]
Newer mind. sorted it out !
#6

[eluser]InsiteFX[/eluser]
So post how you did it so others can learn!

InsiteFX
#7

[eluser]chaminda[/eluser]
Oh, I actually forgot to mention how did i do that!

i had wamp 64bit version (because i am using windows 7 64bit). so what i did was this,

1. uninstall currently installed wamp 64bit (actullay did thi because i messed up my httpd.conf file in apache)

2. Downloaded and installed wamp 32bit.

3. Putting CI files under "c:/wamp/www" directory.

4. create .htaccessfile as mentioned in wiki: mode_rewrite.

5. All working fine !

After that i moved the CI files to a sub directory named as test. so now my CI files path in "c:/wamp/www/test" directory. Then i have edited the .htaccess file's rewrite base. Again, All working fine Smile




Theme © iAndrew 2016 - Forum software by © MyBB