Reputation: 2421
So here's the thing, i've done the tutorial thing on CI, i have already done some modification in .htaccess to remove index.php in URL, in these case, when viewing records index.php doesn't appear, but when i try to create a new record, index.php suddenly appeared, i'm confused as to why it appeared, i've already done something to .htaccess like so,
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Here are some screenies,
Viewing a record:
Creating a new record:
After Creation:
Im confused as to why index.php suddenly appeared, i've already did some changes on .htaccess. am i missing something? please do share your inputs
EDIT I just followed what they ask me to do on their user guide.
<?php echo validation_errors(); ?>
<?php echo form_open('sample_controller/sample_create') ?>
<label for="title">Title</label>
<input type="input" name="title" /><br />
<label for="text">Text</label> <textarea name="text"></textarea><br/>
<input type="submit" name="submit" value="Create news item" />
</form>
Upvotes: 0
Views: 110
Reputation: 3284
change sample_controller/sample_create
to /sample_controller/sample_create
or @cballou answer updating the config will avoid the problem in the first place.
(in config/config.php set $config['index_page'] = ''
)
Upvotes: 1
Reputation: 43467
CodeIgniter also requires you to also make adjustments to your config/config.php
file to remove the default URL suffix of index.php
. It's not highly mentioned in their guides as a necessity when discussing .htaccess.
Upvotes: 0
Reputation: 7488
I think the form action attribute contains the index.php segment. Htaccess isn't enough, edit your CodeIgniter configuration files too to remove.
Upvotes: 0
Reputation: 2540
try RewriteRule ^(.*)$ index.php?/$1 [PT,L]
in place of
RewriteRule .* index.php/$0 [PT,L]
Upvotes: 0