Welcome Guest, Not a member yet? Register   Sign In
Getting rid of index.php in the URI
#1

[eluser]stormbytes[/eluser]
I read pretty much everything in the manual on this, including routes.php/remapping/wild-cards. I'd like some insight on the problem, as I'm fairly new and I'm not sure I understand what's involved.

My issue is this:

Right now, I'm developing on both a local Mamp installation and a remote web host. Both seems to behave identically. If I enter the baseURL, omitting 'index.php' the request is sent to the default controller. That is, example.com resolves the site. However, if I want to target a method of the default controller (other then 'index') I have to reference example.com/index.php/default/method/ - otherwise it does not resolve. What I'm trying to accomplish, provided this is doable, is:

example.com = resolves baseURL (default controller)

example.com/controller/method = resolves the selected method

I'd like to get rid of 'index.php' permanently, if that's possible.

Again - I've read through most of what I could find in the UG, and havent' come up with anything usable. I tried to create .htaccess on both my local Mamp installation and the remote host. No change (other then that nothing resolved!). I don't know anything about Apache configuration and to be honest, I have my hands full learning CI, which is far more satisfying. I'd like a simple 'fix' Smile
#2

[eluser]russ_kern[/eluser]
Here is what I use and it works as I expect it to (And seemingly the way you describe.)

For .htaccess
Code:
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Then in the Routes.php file:

Code:
$route['default_controller'] = "home";

or whatever you default is named.

Does your server allow .htaccess?

Hope it helps.

R
#3

[eluser]stormbytes[/eluser]
Worked like a charm! Thanks Russ -
#4

[eluser]russ_kern[/eluser]
Glad I could help for a change instead of "Be helped"...




Theme © iAndrew 2016 - Forum software by © MyBB