脚本宝典收集整理的这篇文章主要介绍了php – Codeigniter Htaccess和URL重定向问题,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经设定:
Allowoverride All
$config['index_page'] = ''; $config['uri_PRotocol'] = 'REQUEST_URI';
我在Windows上使用XamPP.
我的.htaccess:
RewriteEngine On RewriteCond $1 !^(index\.PHP|images|scripts|css|robots\.txt) rewriterule ^(.*)$/index.PHP/$1 [L]
我的URL仍包含index.PHP,如果我尝试手动删除它,则会返回404错误
另外我的另一个问题是我的登录页面:每当我登录时,我的URL都会卡在检查页面上.
public function check(){ $this->load->model('check'); $LOGcheck = $this->check->check($this->input->post('username'),$this->input->post('password')); if($logcheck == "admin"){ $this->load->view('home'); }else{ $this->load->view('login'); } }
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$index.PHP/$1 [L]
像这样更改您的支票功能
public function check(){ $this->load->model('check'); $logcheck = $this->check->check($this->input->post('username'),$this->input->post('password')); if($logcheck == "admin"){ //may be you need to set login credential into session redirect('PhoneBook/home/'); //$this->load->view('home'); }else{ $this->load->view('login'); } }
你的家庭功能将是这样的
public function home(){ //remember you need to check login validation From session $this->load->view('home'); }
以上是脚本宝典为你收集整理的php – Codeigniter Htaccess和URL重定向问题全部内容,希望文章能够帮你解决php – Codeigniter Htaccess和URL重定向问题所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。