index.php文件仍然需要,即使的.htaccess后 [英] index.php still needed, even after .htaccess

查看:164
本文介绍了index.php文件仍然需要,即使的.htaccess后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我对数字海洋运行的服务器。我试图在上面运行锚CMS。所以,这就是URL应该是什么样子 http://colourity.com/posts/hello-world 。但是,这似乎并没有工作。当我尝试 http://colourity.com/index.php/posts/hello-world ,一切工作正常。但这里的问题是,我使用的.htaccess 来纠正这一点,这里就是我的,

So I have a server running on Digital Ocean. I'm trying to run Anchor CMS on it. So this is what the URL should look like http://colourity.com/posts/hello-world. But that doesn't seem to work. When I try http://colourity.com/index.php/posts/hello-world, all works fine. But the problem here is that I'm using .htaccess to correct this, here's what I have,

 Options -indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

这是应该的戒掉了中的index.php ,此外的mod_rewrite 已启用。我也重新启动服务器,看看是否有差别,但它不是。有任何想法吗?

That should of gotten rid of the index.php, additionally mod_rewrite is enabled. I've also restarted the server to see if that makes a difference, but it hasn't. Any ideas?

推荐答案

的AllowOverride全部 必须包含在Apache的配置,使的.htaccess 规则可以覆盖你的配置。从文档:

AllowOverride All must be included in the Apache configuration so that .htaccess rules can overwrite your configuration. From the documentation:

当服务器发现一个.htaccess文件(由AccessFileName指定),它需要知道哪些指令在该文件中可以覆盖前面的配置指令申报。

When the server finds an .htaccess file (as specified by AccessFileName) it needs to know which directives declared in that file can override earlier configuration directives.

在此指令设置为None,那么.htaccess文件将被完全忽略。在这种情况下,服务器将甚至不试图读取.htaccess文件在文件系统中。

When this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

在此指令设置为All时,所有具有的.htaccess上下文的指令都允许出现在.htaccess文件。

When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files.

它的默认值是所有,但一些模板配置文件可能具有手动设置为。另外请注意,这个语法只适用于&LT;目录/&GT; 部分。

It's default value is All, but some template configuration files may have it manually set as None. Also note, that this syntax is only available in <Directory /> sections.

这篇关于index.php文件仍然需要,即使的.htaccess后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆