2

I know it is the most repetitive question of CI.

I am using Kubuntu and have made following changes

$config['base_url']='http://localhost/cii/';
$config['index_page'] = '';
$config['uri_protocol']= 'REQUEST_URI';

I've kept my .htaccess file where index.php is kept (in the root folder) but am getting following error:

The requested URL /cii/welcome/second was not found on this server.(404 error)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule> 

<IfModule !mod_rewrite.c>
     ErrorDocument 404 /index.php
</IfModule>

2 Answers 2

2

Possibly the problem is due to the AllowOverride None of document root path in apache sites-available configuration file. You need to modify the line containing AllowOverride None to read AllowOverride All in the file (/etc/apache2/sites-available/default) to make .htaccess files work as expected. Do restart apache once after made the changes.

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

Enabling use of Apache htaccess files.

Sign up to request clarification or add additional context in comments.

Comments

0

I would guess that the error is because your CI is located at the subfolder /cii but the rewrite rules point to the root folder. Try adding RewriteBase /cii/ inside the first block.

7 Comments

If that doesn't do the trick, there are a lot of hints here: codeigniter.com/wiki/mod_rewrite
my directory structure is /www/cii/
If your base_url is localhost/cii, then RewriteBase should be /cii/ since it is relative to the domain.
Add the line "RewriteBase /cii" - without quotes, after the line RewriteEngine On
Since the base folder is /cii/, also update ErrorDocument 404 /index.php to ErrorDocument 404 /cii/index.php
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.