2017-07-18 60 views
0

我已經創建了一個使用codeigniter框架的網站,其鏈接如下(xyz.in/index.php/abc),但我只想使用xyz.in打開我的索引頁面。我怎樣才能做到這一點?請幫幫我。如何從codeigniter中刪除更多的url鏈接?

謝謝

+0

也改變$ config ['index_page'] ='index.php';到$ config ['index_page'] ='';在配置文件 – hrishi

+0

[CodeIgniter刪除index.php從URL]可能重複(https://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url) –

+0

設置'$ route ['default_controller' ] ='abc';'在APPPATH.'config/routes.php''中。 – Tpojka

回答

0

你嘗試過用.htaccess文件

RewriteEngine On 
RewriteBase /root_folder_name/ 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt) 
RewriteRule ^(.*)$ /index.php/$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 

更多信息 - >CodeIgniter removing index.php from url

+0

是的,看看這個 RewriteEngine敘述上 的RewriteCond%{} REQUEST_FILENAME!-f 的RewriteCond%{} REQUEST_FILENAME!-d 重寫規則^(。 *)$ index.php/$ 1 [L,QSA] omkara

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

請將此代碼放在它的.htaccess文件,並將該文件的外應用文件夾。