简体   繁体   English

codeigniter网址http://www.website.com/index.php/index.php/page

[英]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 我一直在努力让.htaccess文件在codeigniter上工作,当您加载除索引之外的其他页面时,每次在我的导航栏中单击链接时,它都会附加在index.php /上,因此在遇到该问题时遇到了问题首先单击一个链接,最终得到类似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 当我从网站http://website.com/new/index.php/website.com/new/img/gallery/fw1.jpg打开图片时

My link same as index.php/About">Aboutour team 我的链接与index.php / About“>关于我们的团队相同

My config file $config['base_url'] = 'website.com/new/'; 我的配置文件$ 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: 我使用以下.htaccess文件,该文件对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): 您还应该检查application / config / config.php文件以确保它具有以下几行(空白的base_url设置表示CodeIgniter将自动生成它):

$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. 您可以为每个链接使用site_url(),以确保最大的可移植性。 eg 例如

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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