zaz*_*iki 5 php codeigniter http-status-code-302
我已经尝试了一切,我接近放弃了.请帮忙.
我一直试图摆脱codeigniter中的index.php并完成了谷歌提供的每个代码以放入.htaccess.
目前,我有这个.
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]
Run Code Online (Sandbox Code Playgroud)
这确实有效,但每次我提交表格时,我都会收到这个令人抓狂的错误的302错误.

我控制器中的一个提交功能......其他形式的其他功能基本相同.我已经尝试了刷新和重定向的定位方法,既没有改变任何东西.我不相信这是问题所在.
public function submitStory(){
if (empty($this->user)) {
redirect('/home/');
}else{
$this->story_model->writeStory();
redirect('story/newChapterView/');
}
Run Code Online (Sandbox Code Playgroud)
}
我的模型只是插入数据库
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);
}
Run Code Online (Sandbox Code Playgroud)
我的一个表单,它们几乎只是一个标准的codeigniter表单
<?=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>
Run Code Online (Sandbox Code Playgroud)
用这个:
<IfModule mod_rewrite.c>
RewriteEngine On
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)