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 如何构建全国统一的物流管理平台?
  • ¥100 ijkplayer使用AndroidStudio/CMake编译,如何支持 rtsp 直播流?
  • ¥20 和学习数据的传参方式,选择正确的传参方式有关
  • ¥15 这是网络安全里面的poem code
  • ¥15 用js遍历数据并对非空元素添加css样式
  • ¥15 使用autodl云训练,希望有直接运行的代码(关键词-数据集)
  • ¥50 python写segy数据出错
  • ¥20 关于线性结构的问题:希望能从头到尾完整地帮我改一下,困扰我很久了
  • ¥30 3D多模态医疗数据集-视觉问答
  • ¥20 设计一个二极管稳压值检测电路