大佬教程收集整理的这篇文章主要介绍了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都会卡在检查页面上.
我想知道如何重写我的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'); }
使用重定向功能记得你已经加载了url Helper.可能对你有所帮助
以上是大佬教程为你收集整理的php – Codeigniter Htaccess和URL重定向问题全部内容,希望文章能够帮你解决php – Codeigniter Htaccess和URL重定向问题所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。