簡體   English   中英

Codeigniter錯誤,文件不存在

[英]Codeigniter error, file doesn't exist

HTTP:// mysite的/產品/創建

Not Found

The requested URL /products/create was not found on this server.
Apache/2.2.16 (Debian) Server at site5.example.com Port 80

從服務器錯誤=>

[Sun Aug 28 23:51:45 2011] [error] [client 127.0.0.1] File does not exist: /var/www/CodeIgniter_2.0.2/products

routes.php =>

$route['default_controller'] = 'products';
$route['404_override'] = '';

我該怎么辦?

為什么會出錯?

在CodeIgniter_2.0.2 =>的.htaccess文件中

Deny from all

codeigniter的虛擬主機=>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName mysite.com

    DocumentRoot /var/www/CodeIgniter_2.0.2

    <Directory /var/www/CodeIgniter_2.0.2>
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

</VirtualHost>

除非您有.htaccess重寫,否則正確的URL應該是http://yoursite.com/index.php/products 請注意包含index.php和正確的域。

我的虛擬主機配置:

 <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName mysite.com

        DocumentRoot /var/www/CodeIgniter_2.0.2

        <Directory /var/www/CodeIgniter_2.0.2>
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>

    </VirtualHost>

我的文件.htaccess:

<ifModule mod_rewrite.c>                                                                                                                           
       RewriteEngine On                                                                                                                               
      RewriteCond %{HTTP_HOST} ^IP$ [NC]                                                                                                     
       RewriteCond %(REQUEST_FILENAME) !-f                                                                                                            
       RewriteCond %(REQUEST_FILENAME) !-d                                                                                                            
      RewriteCond $1 !^(index\.php|css|images|js|robots\.txt)                                                                                         
       RewriteRule ^(.*)$ ./index.php/$1 [L]                                                                                                          
   </ifModule>                                                                                                                                        
   <ifModule !mod_rewrite.c>                                                                                                                          
      ErrorDocument 404 /IP/CodeIgniter_2.0.2/index.php                                                                                        
  </ifModule>    

它很棒!! :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM