0

My .htaccess file is:

RewriteEngine on

RewriteCond $1 !^(index\.php|resources|robots\.txt|img/|css/|js)

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

It removes index.php from the URL and forces a redirect from example.net to www.example.net, but when I enter http://example.net, it does not redirect to www.example.net. How can solve this?

3 Answers 3

1

In .htaccess file Change this

RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

To

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

and in config file made 2 changes:

$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/CiFolderName';
$config['index_page'] = '';
Sign up to request clarification or add additional context in comments.

Comments

0

set your htaccess

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On
  #RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]
</IfModule>

remove index.php in your config

$config['index_page'] = '';

Also allow overriding htaccess in your apache

nano /etc/apache2/sites-available/default

and change

        AllowOverride All

and restart apache

Comments

0

Have the.htaccess file in the application root directory, along with the index.php file. (Check if the htaccess extension is correct , Bz htaccess.txt did not work for me.)

And Add the following rules to .htaccess file,

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]  

Then find the following line in your application/config/config.php file

$config['index_page'] = 'index.php';

Set the variable empty as below.

$config['index_page'] = '';

That's it, it worked for me.

If it doesn't work further try to replace following variable with these parameters ('AUTO', 'PATH_INFO', 'QUERY_STRING', 'REQUEST_URI', and 'ORIG_PATH_INFO') one by one

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

Comments

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.