0
votes

I will try to explain my problem as simple as possible.

My index URI is working as well and displays my "test" message.

https :// domain.com /

But other URIs doesn't work and displays "File not found" message.

https :// domain.com / about

Whereas, this URI is working like i want :

https :// domain.com / index.php / about

I really don't understand why, can someone help me ? thanks for your help ! :)

my route

$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';

my .htaccess

RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}  [R=301,L]

RewriteRule ^pages/view(/)?(.*)$ /$2 [R=301,L]
RewriteRule ^pages(/)?(.*)$ /$2 [R=301,L]

RewriteCond $1 !^((user_guide|img|css|js|scripts|fonts)\/.*|index\.php|assets/|robots\.txt|.*\.css)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

my controller file name

Pages.php

my controller class

<?php
class Pages extends CI_Controller {

    public function view($page = 'home')
    {
        echo'test';
        exit;
    }
}
?>

my config uri protocol (i've already tried with QUERY_STRING and PATH_INFO)

$config['uri_protocol'] = 'REQUEST_URI';

I would be really happy to get your help !

1

1 Answers

8
votes

try using the following in .htaccess and check.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]