简体   繁体   中英

codeigniter url http://www.website.com/index.php/index.php/page

Ive been struggling to get a .htaccess file working on codeigniter, im having that issue when you load any other page aside index that, every time you click on a link in my nav bar it tacks on an index.php/, so after the first click on a link, you end up with things like http://www.website.com/index.php/index.php/page

When I open an image from site http://website.com/new/index.php/website.com/new/img/gallery/fw1.jpg

My link same as index.php/About">Aboutour team

My config file $config['base_url'] = 'website.com/new/';

How can I solve this problem?

I use the following .htaccess file, which has always worked for me with CodeIgniter:

<IfModule mod_rewrite.c>
     RewriteEngine on

     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d

     RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

You should also check your application/config/config.php file to make sure it has the following lines (a blank base_url setting means CodeIgniter will auto-generate it):

$config['base_url'] = '';
$config['index_page'] = '';

You might also want to check you're generating the links themselves correctly. You can use site_url() for every link to ensure maximum portability. eg

<a href='<?=site_url('about')?>>About</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM