Welcome Guest, Not a member yet? Register   Sign In
always index
#1

(This post was last modified: 06-28-2023, 05:02 PM by kenjis.)

Hello, my problem is: my index.php file is in public folder ,my view about.php is in Views folder. I made a Controller About.php 
PHP Code:
<?php

    
namespace App\Controllers;  
    
class About extends BaseController{

        public function  index() {
            return view('about');
        }
    }
?>

with route 
$routes->get('/about','About::index');

but when i click on about page in URL is virtualhostrname/about.php but the index is always displayed.
.htacces file is ok rewrite engine is on 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule^([\s\S]*)$ index.php/$1 [L,NC,QSA] 

.env
app.$baseURL='htttp://virtualhostname/'

in app config
public string $baseURl='http://virtualhostname/'

and always is index page  and in url is virtualhostname/about.php


        }
Reply
#2

The URL should be http://virtualhostname/about
Not http://virtualhostname/about.php

Try the official tutorial:
https://codeigniter4.github.io/CodeIgnit...index.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB