I want my URL's to look like: 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');
You actually need the .htaccess file in the root of the codeigniter directory(wherever index.php is). The .htaccess file is responsible for managing the rewriting of parameters. if you query yoursite.com/?controller/model, it will work the same as if index.php were there. The "?controller/..." will still be there, but index.php will not be there as long as you remember to always link to the non index.php version. The included .htaccess will work in most cases (especially with apache). You may need to modify if codeigniter is not in the root of your site(i.e. public_html/somedir/{codeigniter_goes_here}).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With