简体   繁体   English

如何在Codeigniter中修复网站的网址?

[英]How to fix the url of a website in codeigniter?

I have a website and the url of the website is ' http://www.learningfactor.in/ '. 我有一个网站,该网站的网址为“ http://www.learningfactor.in/ ”。 But when I am taking the website in the browser, it is showing a 404 page error. 但是,当我在浏览器中访问网站时,它显示404页面错误。 The actual website is ' http://www.learningfactor.in/site/home '. 实际的网站是“ http://www.learningfactor.in/site/home ”。 How can I direct to the second url from the first url. 如何从第一个网址定向到第二个网址。 The website is coded in codeigniter. 该网站使用codeigniter编码。 Can anyone help me out in this ? 有人可以帮我吗?

htaccess code is shown below. htaccess代码如下所示。

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

I'm sure that there are more elegant ways to do it, but you can just do the redirect in your home /default controller. 我敢肯定有更优雅的方法可以做到这一点,但是您可以在home / default控制器中进行重定向。

public function index () {
    $this->load->helper('url');
    redirect('/site/home);
}

In Codeigniter index method of the "default" controller is called automatically when you visit the homepage. 在Codeigniter的索引方法中,访问默认网页时会自动调用“默认”控制器的索引方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM