简体   繁体   中英

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/ '. But when I am taking the website in the browser, it is showing a 404 page error. The actual website is ' http://www.learningfactor.in/site/home '. How can I direct to the second url from the first url. The website is coded in codeigniter. Can anyone help me out in this ?

htaccess code is shown below.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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