CodeIgniter Forums
htaccess subdirectory remove index.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: htaccess subdirectory remove index.php (/showthread.php?tid=33858)



htaccess subdirectory remove index.php - El Forum - 09-10-2010

[eluser]Unknown[/eluser]
Hello,

I'm just starting out with CodeIgniter and I've been stuck on this issue for quite a while.
I'm trying to remove the index.php from the url via a .htaccess file.

I've tried several variations that I have found, but none seem to actually
remove that index.php portion of the url.

The following code allows me to navigate my site fine, but it handles
exactly as if I didn't have a .htaccess file at all.

My URL's appear like:
http://www.MyServer.com/ChucksCITest/index.php/class/method

I would like to have them appear as:
http://www.MyServer.com/ChucksCITest/class/method

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

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

Any thoughts?

* EDIT Nevermind - I changed the line:

RewriteRule ^(.*)$ index.php/$1 [L]

to:
RewriteRule ^(.*)$ index.php?$1 [L]

And changed the config file to remove the "index.php" as the defualt
for:
$config['index_page'] = "index.php";