2

I tried all the methods that are found including on this site. But it did not work redirect.

My config.php

    $config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'];

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$  /$1 [R=301,L] 




RewriteCond %{HTTP_HOST} ^www.**.ru$ [NC]
RewriteRule ^(.*)$ http://**.ru/$1 [R=301,L]


RewriteCond $1 !^(robots\.txt|index\.php|image\.php|favicon\.ico|upload|sotrudnik|generator|links|assets|agents|old|sitemap\.xml|4cc707e99fb15630dc\.html|sitemap_mobile\.xml|yandex_6bfb7e8daf6b3458\.html|holder\.js)
RewriteRule ^(.*)$ /index.php/$1 [L]

this .htaccess

1
  • did u find the solution? Commented Jan 16, 2016 at 6:56

3 Answers 3

1

You can use mod-rewrite of Apache to rewrite paths that do not contains "index.php" into /index.php/*** paths, for example this way :

.htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php/$1 [L]

I think you should restore original value of $config['index_page'] : this is not the solution and it can have drawbacks

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

1 Comment

Is mod_rewrite module enabled ? What does Apache's error log say ?
1

You can try with the following .htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

And please change your config.php like bellow:

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

Do not forget to enable mod_rewrite.

Comments

0

I use windows and xampp.

With this htaccess in main directory

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Once created htaccess in main directory then go to config.php look for the index_page make sure is blank like below

$config['index_page'] = '';

More examples found here https://github.com/riwakawebsitedesigns/htaccess_for_codeigniter

You also may need to configure your routes in application/config/routes.php

http://www.codeigniter.com/user_guide/general/routing.html

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.