2015-02-23 108 views
0

我用codeigniter構建了一個網站,當我上傳它時,它給了我那個錯誤在此服務器上找不到請求的文檔。我知道問題出在我的.htaccess代碼上。所以任何人都可以幫助我?如何使用Godaddy.com中的Codeigniter刪除index.php

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

以下答案是否適合您? – Niroshan 2017-07-15 04:59:42

回答

1

嘗試與JS上市這個(事情| CSS等不會使用重寫

Options +FollowSymlinks 
    RewriteEngine on 

    # On Rackspace and getting 404's? Uncoment this by removing the # : 
    # RewriteBase/

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

    <IfModule mod_rewrite.c> 
     RewriteRule ^(.+)\.(\d+)\.(js|css|docs|img|invoices|support|demos|blog|devx)$ $1.$3 [L] 
    </IfModule> 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
+0

這個答案在Godaddy的共享管理中適用於我 – Niroshan 2017-07-15 05:03:01

1

在一個共享主機我有這一套:

RewriteEngine on 
RewriteBase/
Options -Indexes 
RewriteCond $1 !^(index\.php|robots\.txt|assets) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/\?$1 [L] 

而且,

/* 
|-------------------------------------------------------------------------- 
| Base Site URL 
|-------------------------------------------------------------------------- 
| 
| URL to your CodeIgniter root. Typically this will be your base URL, 
| WITH a trailing slash: 
| 
| http://example.com/ 
| 
| If this is not set then CodeIgniter will guess the protocol, domain and 
| path to your installation. 
| 
*/ 
$config['base_url'] = 'http://example.tld/'; 

/* 
|-------------------------------------------------------------------------- 
| Index File 
|-------------------------------------------------------------------------- 
| 
| Typically this will be your index.php file, unless you've renamed it to 
| something else. If you are using mod_rewrite to remove the page set this 
| variable so that it is blank. 
| 
*/ 
$config['index_page'] = '';