dongqishun6409 2014-05-04 11:11
浏览 62
已采纳

htaccess没有重定向到主index.php

htaccess will not redirect whatever I type to the index.php on my server. But it works perfectly on my local server (wamp).

This is the htaccess:

<IfModule mod_rewrite.c>
    Options -MultiViews

    RewriteEngine on
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]
</IfModule>

It's the most basic htaccess ....

If I go to the main url there is no problem and the page loads but if I type something like /inventaris/index it gives me a 404 page.

On the same server i have other websites using htaccess. One of them is a wordpress blog with permalinks so mod_rewrite is enabled.

Anyone has an idea why this won't work? My live server is running on 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条回答 默认 最新

  • dongzhu6900 2014-05-04 18:30
    关注

    After some debugging I found out that the .htaccess file wasn't doing anything. Not even a basic forward.

    After some googling I update the virtual host setting AllowOverride None to AllowOverride All. Same thing for the default virtual host (just to be sure). And it seem to work now.

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    

    Explanation I found: 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog