I want my URL’s to look like: http://www.domain.com/controller/view/args instead of index.php?/controller/view/args. Actually, I NEVER want the url “index.php?…” to validate. Can anybody give me a hint on how to enforce this behavior, because when I do: A) redirect() or B) type in manually ‘index.php'”…” the url changes to that ugly pattern.
This is my .htaccess file (I don’t know if I need this file, just copy+pasted from the internet):
#http://codeigniter.com/wiki/Godaddy_Installaton_Tips/
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
This is my config.php:
$config['base_url'] = '';
$config['index_page'] = 'index.php?';
$config['uri_protocol'] = 'AUTO';
$config['enable_query_strings'] = FALSE;
And this is what changes the behaviour:
redirect('...blah', 'either location or refresh');
In addition to needing to place the .htaccess in the root of the codeigniter install (in the same place as the index.php), you’ll also need to ensure that mod_rewrite is working on your Apache install, otherwise the .htaccess file will just be ignored.
Additionally, you need to set the AllowOverride directive in your Apache virtual host (see http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride) – it should be set to something like:
You should also change:
To: