I have tried everything and I am close to giving up. Help please.
I've been trying to get rid of the index.php in codeigniter and have done every code that google has provided to put in the .htaccess.
Currently, I have this.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
and this does work, but every time I submit a form, I get back this wonderful 302 error that is driving me crazy.
one of my submit function in my controller...the others are basically the same for other forms. I have already tried the refresh and the location method of redirecting, neither change anything. I do not believe this is the issue.
public function submitStory(){
if (empty($this->user)) {
redirect('/home/');
}else{
$this->story_model->writeStory();
redirect('story/newChapterView/');
}
}
my model is just inserting into the database
public function writeStory(){
$this->title = strip_tags($this->input->post('wTitle'));
$this->date = time();
$this->author = strip_tags($this->input->post('wAuthor'));
$this->type = strip_tags($this->input->post('wType'));
$this->db->insert('story_tbl', $this);
}
one of my forms, their pretty much just a standard codeigniter form
<?=form_open('story/submitStory', array('id' => 'newStory'));?>
<p class="textBox"><label>Story Title: </label><input id="storyTitle" type="text" name="wTitle" autocomplete="off" /></p>
<p><label>Complete:</label><select class="drop" name="wcomplete" id="complete"><option value="no">no</option><option value="yes">yes</option></select></p>
<p><label>Description: </label><textarea name="wDescription" id="wDescription" class="wDescription"></textarea><span id="discWarn">500 characters left</span></p>
<p class="submit"><input type="submit" value="Submit Details" /></p>
</form>
The simplest one:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
If it doesn't help then you should check mod_rewrite is enabled.
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