htaccess不会将我输入的内容重定向到我服务器上的 index.php
. 但它在我的本地服务器(wamp)上运行良好 .
这是htaccess:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>
这是最基本的htaccess ....
如果我去主网址没有问题,页面加载,但如果我输入类似 /inventaris/index
的东西,它给我一个404页面 .
在同一台服务器上,我有其他网站使用htaccess . 其中一个是带有永久链接的wordpress博客,因此启用了mod_rewrite .
任何人都知道为什么这不起作用?我的实时服务器在Ubuntu上运行 .
Update: Loaded Modules
core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_rewrite mod_setenvif mod_status
3 回答
确保FollowSymLinks设置在Options下,我会使用
这也有助于你获得
PATH_INFO
.经过一些调试后,我发现
.htaccess
文件没有做任何事情 . 甚至不是一个基本的前锋 .在一些谷歌搜索后,我将虚拟主机设置
AllowOverride None
更新为AllowOverride All
. 默认虚拟主机也是一样(只是为了确定) . 它似乎现在有效 .解释我发现: You need to modify the line containing AllowOverride None to read AllowOverride All. This tells Apache that it's okay to allow .htaccess files to over-ride previous directives.