2017-03-04 115 views
0

一切都運行完美的本地主機,但是當我在服務器主機上,它表明:笨沒有輸入文件中指定

沒有輸入文件中指定

請幫我解決這個問題。

我的.htaccess文件看起來是這樣的:

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

上面的代碼是從本地主機或虛擬主機服務器?因爲把?最後一行index.php後標記解決了這個問題在虛擬主機服務器上,沒有?在localhost上標記它可以正常工作。 –

+0

http://stackoverflow.com/questions/6118740/codeigniter-no-input-file-specified –

回答

1

我終於使用這個,它爲我工作。

DirectoryIndex index.php 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA] 

如果有任何建議可以分享,請發帖。

0

你可能有不允許.htaccess覆蓋不同的服務器配置。編輯Apache的httpd.conf使AllowOverride

AllowOverride All 

你可以嘗試用http://server.com/index.php/controller/function API訪問來執行,以確保這種情況。

0

嘗試更換這個代碼到你的.htaccess文件

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

<IfModule mod_deflate.c> 
    # Compress HTML, CSS, JavaScript, Text, XML and fonts 
    AddOutputFilterByType DEFLATE application/javascript 
    AddOutputFilterByType DEFLATE application/rss+xml 
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
    AddOutputFilterByType DEFLATE application/x-font 
    AddOutputFilterByType DEFLATE application/x-font-opentype 
    AddOutputFilterByType DEFLATE application/x-font-otf 
    AddOutputFilterByType DEFLATE application/x-font-truetype 
    AddOutputFilterByType DEFLATE application/x-font-ttf 
    AddOutputFilterByType DEFLATE application/x-javascript 
    AddOutputFilterByType DEFLATE application/xhtml+xml 
    AddOutputFilterByType DEFLATE application/xml 
    AddOutputFilterByType DEFLATE font/opentype 
    AddOutputFilterByType DEFLATE font/otf 
    AddOutputFilterByType DEFLATE font/ttf 
    AddOutputFilterByType DEFLATE image/svg+xml 
    AddOutputFilterByType DEFLATE image/x-icon 
    AddOutputFilterByType DEFLATE text/css 
    AddOutputFilterByType DEFLATE text/html 
    AddOutputFilterByType DEFLATE text/javascript 
    AddOutputFilterByType DEFLATE text/plain 
    AddOutputFilterByType DEFLATE text/xml 

    # Remove browser bugs (only needed for really old browsers) 
    BrowserMatch ^Mozilla/4 gzip-only-text/html 
    BrowserMatch ^Mozilla/4\.0[678] no-gzip 
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
    Header append Vary User-Agent 
</IfModule> 
相關問題