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>
答案 0 :(得分:4)
除非您有.htaccess
重写,否则正确的网址应为http://yoursite.com/index.php/products。请注意包含index.php和正确的域。
答案 1 :(得分:0)
我的虚拟主机配置:
<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>
效果很好!! :)