-1

I need to hide/remove the index.php in the URL's of my application in CodeIgniter. I proved something i saw in a tutorial on youtube but in didn't work, the solution was writing something in my .htaccess.

Here's my repository:

https://github.com/ashcrimson/CodeIgniter/tree/master/CodeIgniter

And here you have my .htaccess file:

Options FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.")$ index.php?/$1 [L]
</IfModule>

<IfModule !mode_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

http://pastebin.com/eCU5UgL0

Felipe Pino
  • 131
  • 1
  • 7

1 Answers1

0

Below is my .htaccess to take out index.php from the URL.

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

The RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] should be ^(.*)$ not ^(.")$

Check the rule. Wish it helps.

^(.*)$ ./index.php/$1 represents whatever you requested, redirect it to the index.php file which can handle the passing parameters.

In regex, . means anything; * means 0 or more times.

Benyi
  • 912
  • 2
  • 9
  • 24