2016-09-16 93 views
1

我剛剛在godaddy的子文件夾中上傳了我的演示項目。當我打開一個網站的網址example.com/demo首頁工作正常,但是當我打開內頁我的網址看起來像example.com/demo/index.php?/home/overview。(有問號)Url無法在codeigniter中工作

我只是想重寫我的網址,我試圖刪除我的URL看起來像example.com/demo/home/overview後刪除的index.php,但沒有奏效。

需要更好的解決方案。

我的.htaccess文件和配置文件都在這裏上傳:

Godaddy - Codeigniter - No input file specified on server

回答

1

編輯在htaccess文件

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

配置基本URL中的config.php文件也。

0

檢查config.php文件

$config['base_url'] = "http://".$_SERVER['HTTP_HOST']."/projectname"; 
$config['uri_protocol'] = 'PATH_INFO'; 

有時會引起麻煩,由於在部分的RewriteCond htaccess文件

RewriteEngine on 
RewriteCond $1 !^(index\.php|images|system|css|js|style|robots\.txt) 
RewriteRule ^(.*)$ index.php/$1 [L] 

手動添加文件夾/文件名。請確保您保留由'|分隔的名稱' 上面的變化對我有用

相關問題