• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How remove index.php from URLs? [SOLVED]

#1
[eluser]CoderReborn[/eluser]
I'm following exactly what's in the User Guide, but still cannot remove index.php from my URLs.

- My "system" folder is at my root
- My controller called "home" is located at /system/application/controllers/home.php

- This works: http://localhost/index.php/home
- This does not work: http://localhost/home

Here what I added to my .htaccess file:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]


It looks like the index.php file at the root needs to be executed before the path to the controllers can be discovered?

Thanks.

#2
[eluser]rufnex[/eluser]
try this:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

#3
[eluser]CoderReborn[/eluser]
Thanks, this works for me!

I also had to add the .htaccess file to my root directory.
A little tricky since Macs hide all files that start with with a ".".
But I used a utility called InVisibles to toggle between seeing/hiding invisible files.

#4
[eluser]Dunrobin[/eluser]
My thanks as well, rufnex. That worked perfectly for me.

#5
[eluser]vindhyareddy[/eluser]
Where do we put the .htaccess file?

If my url is like :
localhost/devapp/index.php/<<controllername>>/<<function name>>/

I want this to be
localhost/devapp/<<controllername>>/<<function name>>/

I have written the .htaccess file as :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Where do I put this .htaccess file?

I tried out many combinations but, I kept getting a 500:Internal Server Error.

#6
[eluser]CoderReborn[/eluser]
I have it in my document root.

I have a MAMP stack installed on my Mac, and my document root is: /Applications/MAMP/htdocs

#7
[eluser]vindhyareddy[/eluser]
I have WAMP.

So must it be in the application folder of my application?

#8
[eluser]Dunrobin[/eluser]
[quote author="vindhyareddy" date="1279660302"]Where do we put the .htaccess file?

If my url is like :
localhost/devapp/index.php/<<controllername>>/<<function name>>/

I want this to be
localhost/devapp/<<controllername>>/<<function name>>/

(...)

Where do I put this .htaccess file?

I tried out many combinations but, I kept getting a 500:Internal Server Error.[/quote]

I believe that the file should be in the folder that has your CodeIgniter installation, in your example in your devapp folder. (It should be in the same folder as the index.php file.) I haven't tried it on my localhost, but that worked fine on my online server.

#9
[eluser]pickupman[/eluser]
Dunrobin is correct. I run WAMP locally as well. htaccess should go into same folder as your CI's index.php file.

#10
[eluser]vindhyareddy[/eluser]
http://ellislab.com/forums/viewthread/161533/

This is the place where another problem discussion is going on!
Can you'll help me out there?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.