[eluser]tdktank59[/eluser]
So ive found a few questions about mod rewrite as well as had a bunch of problems doing it myself.
So heres a collection of everything I found.
Is mod rewrite turned on?
First off your host needs to have mod rewrite turned on and configured properly. Since most host do by default you should be set otherwise contact them to see if you can get them to enable it.
One way to tell if it is enabled is create a file and put this into it
Code:
<?php
echo phpinfo();
?>
search the page for mod_rewrite if it shows up then its enabled otherwise it is not.
So you say your using XAMPP?
Since you are running xampp on your local machine heres how to setup mod rewrite to work.
* note: It works for me this way. If there is a better way then please post below and I will verify and update this post *
Modify httpd.conf (by default httpd.conf should be located at "C:\xampp\apache\conf")
Step1: load mod rewrite module
find the line that has this
Code:
#LoadModule rewrite_module modules/mod_rewrite.so
remove the # so it looks like this
Code:
LoadModule rewrite_module modules/mod_rewrite.so
Step 2: Allow override
find every line that has this (theres a few of them)
change it to
Setup .htaccess
create a file where you index.php file is for CI and name it .htaccess
in the file put this code
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
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>
Make sure you have the line
point to the right location by default it will go to localhost if you are using xampp otherwise it will go the domains is located.
Configuring CI
Find the config.php file (by default "CI/system/applications/config/config.php")
now remove remove index.php from the index_page config item so it should be ""
And change the URI PROTOCOL to REQUEST_URI
The changes
Code:
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "";
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = "REQUEST_URI";
And there you go if you modified httpd.conf you will need to reboot apache otherwise it should work now!
If it dose not work let me know and we can figure out what is going wrong.
Again this was the method with how I got it to work.. There may be a better or more efficient way to make it work. However all the methods I found on CI did not work for me.