我正在尝试将我的网络上传到服务器,这是Suse 13.我已经安装了Apache2.4和PHP 5.6。在Windows中,同一个网站运行良好,但不适用于Suse。如果我在方向栏http://myip/myweb/index.php/ControllerName/MethodName上书写它可以工作,但路由不起作用。
我的控制器文件中有一个大写字母Controller.php,里面的类名是Controller,方法是“method”,小写。在routes.php我有:
$route['default_controller'] = 'controller';
$route['bar/foo'] = 'controller/method';
我的config.php文件:
$config['base_url'] = 'http://myip/myweb/';
$config['index_page'] = ''; //I can see the index page correctly
$config['uri_protocol'] = 'REQUEST_URI';
最后,我的.htaccess文件:
RewriteEngine On
ServerSignature Off
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE model/vnd.collada+xml
# remove browser bugs
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>
我需要帮助,我不知道该怎么做......
谢谢!
编辑:
在apache中启用模块:
actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir php5 reqtimeout authn_core authz_core version man rewrite
答案 0 :(得分:0)
人们,如果你想知道f ***是什么错误,你必须知道在Apache配置文件中你必须添加AllowOverride All !!!