簡體   English   中英

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

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

我一直在努力讓.htaccess文件在codeigniter上工作,當您加載除索引之外的其他頁面時,每次在我的導航欄中單擊鏈接時,它都會附加在index.php /上,因此在遇到該問題時遇到了問題首先單擊一個鏈接,最終得到類似http://www.website.com/index.php/index.php/page的信息

當我從網站http://website.com/new/index.php/website.com/new/img/gallery/fw1.jpg打開圖片時

我的鏈接與index.php / About“>關於我們的團隊相同

我的配置文件$ config ['base_url'] ='website.com/new/';

我怎么解決這個問題?

我使用以下.htaccess文件,該文件對CodeIgniter一直有效:

<IfModule mod_rewrite.c>
     RewriteEngine on

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

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

您還應該檢查application / config / config.php文件以確保它具有以下幾行(空白的base_url設置表示CodeIgniter將自動生成它):

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

您可能還需要檢查自己是否正確生成了鏈接。 您可以為每個鏈接使用site_url(),以確保最大的可移植性。 例如

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM