0

我已经在 windows server 2008 R2 上安装了 PHP、Mysql 和 Apache,因为这个链接完全提供了。

它就像一个魅力,但问题在于我的.htaccessto remove index.php

我的.htaccess文件包括以下内容:

   <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /HR/    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule> 

mod_rewrite我已经在apache中启用了。但我收到 500 个内部服务器错误。

注意:当更改AllowOverRide AllNone文档根目录时,如下所示:

# AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

500 internal error消失但不起作用.htaccess!然后我应该添加index.php链接才能工作。

注意:当AllowIverRide All我收到此错误时:

[Tue Feb 19 18:20:10.988018 2013] [core:alert] [pid 3940:tid 844] 
[client 127.0.0.1:49513] C:/Apache24/htdocs/HR/.htaccess: 
RewriteBase takes one argument, the base URL of the per-directory context

任何帮助将不胜感激。泰。

4

1 回答 1

1

不要完全改变你的 .htaccess ,但这是我使用的一个例子,我从来没有遇到任何问题。这只是关于 modrewrite 的部分:

RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !^(templates|plugins)
  RewriteRule ^(.*)$ index.php/$1 [L]
于 2013-02-19T15:29:58.597 回答