2015-02-23 107 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'] = '';