0

I have a codeigniter project with the my baseurl as localhost/app

my controller is blog so when I visit localhost/app/blog I get the information on the view. Although when I visit just localhost/app nothing shows just the header and the footer.

So my question is how do I either redirect to my main page which is localhost/app/blog when some enters in localhost/app

Or are there any other work arounds to fix this where it redirects to a controller when just the base url is called?

My blog contoller (I used index to see if it would automatically redirect.

  public function index(){

  $data['title'] = 'Newest';


  $this->load->view('templates/header');
  $this->load->view('posts/index', $data);
  $this->load->view('templates/footer');

}

.htaccess

RewriteEngine On
RewriteBase /app
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
JS_noob
  • 97
  • 8

0 Answers0