简体   繁体   English

.htaccess 文件在我的 codeigniter 应用程序中导致禁止错误,我在我的 Z0F41370ED1502B8B5045D 中运行 apache 24

[英].htaccess file causing forbidden error in my codeigniter application, I am running apache 24 in my windows server

Without the .htaccess file the application running perfectly, Whenever I add .htaccess file it showing forbidden don't have access to the / server.如果没有 .htaccess 文件,应用程序运行完美,每当我添加 .htaccess 文件时,它显示禁止访问 / 服务器。 I tried to put "Test."我试着输入“测试”。 in the first line of .htaccess file it "showing Internal server error" that's good apache reading .htaccess file.在 .htaccess 文件的第一行它“显示内部服务器错误”这很好 apache 读取 .htaccess 文件。 But whenever it read "RewriteEngine on" line in .htaccess file immediately it showing forbidden error.但是,每当它立即读取 .htaccess 文件中的“RewriteEngine on”行时,它就会立即显示禁止错误。

here is my .htaccess file.这是我的 .htaccess 文件。

 RewriteEngine on
 RewriteCond $1 !^(index\.php|resources|robots\.txt)
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php/$1 [L,QSA]

And httpd.config file和 httpd.config 文件

   DocumentRoot "${SRVROOT}/htdocs"
   <Directory "${SRVROOT}/htdocs">
   #
   # Possible values for the Options directive are "None", "All",
   # or any combination of:
   #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
   #
   # Note that "MultiViews" must be named *explicitly* --- "Options All"
   # doesn't give it to you.
   #
   # The Options directive is both complicated and important.  Please see
   # http://httpd.apache.org/docs/2.4/mod/core.html#options
   # for more information.
   #
   Options Indexes FollowSymLinks

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

   #
   # Controls who can get stuff from this server.
   #
   Require all granted
   Options ExecCGI 
   </Directory>
  1. There is no need to change httpd.conf file, .htaccess file is enough to make your CI project up and running.无需更改httpd.conf文件, .htaccess文件足以让您的CI项目启动并运行。
  2. But if you must, you need to give absolute path in DocumentRoot ie change ${SRVROOT}/htdocs to "F:/xampp/htdocs" -- (your/location/here)但如果必须,您需要在DocumentRoot中提供绝对路径, ${SRVROOT}/htdocs更改为"F:/xampp/htdocs" -- (your/location/here)
  3. ${SRVROOT} will not work as you are not writing in a .php file. ${SRVROOT}将不起作用,因为您没有写入.php文件。

See these for more info --有关更多信息,请参阅这些-

This is my httpd.conf file -这是我的httpd.conf文件 -

DocumentRoot "F:/xampp/htdocs"
<Directory "F:/xampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

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

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

my .htaccess -我的.htaccess -

RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1  
# if your base_url() doesn't have a trailing slash then instead of ↑ use ↓- 
# RewriteRule (.*) /index.php/$1

Hope this helps you.希望这对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Server上运行的Apache上的htaccess文件是否不同 - Is a htaccess file different on apache running on a windows server 我作为服务运行的Java应用程序在Windows 2008上导致磁盘已满错误。从资源管理器中看不到任何内容 - My java application running as a service is causing disk full error on windows 2008. Ca't see anything from the explorer Windows 10上的Laravel Apache24-&gt; 403禁止 - Laravel Apache24 on Windows 10 -> 403 Forbidden 在哪里可以找到在 Windows 上运行的 Emacs 的 .emacs 文件? - Where can I find my .emacs file for Emacs running on Windows? Windows 服务器上的 .htaccess 文件 - .htaccess file on windows server 在Windows .bat文件中运行Python脚本 - Running Python script in my Windows .bat file 当我尝试在 Windows 版本中运行我现有的颤振项目时,我收到了这个错误 - when I try to run my existing flutter project in windows version, I am getting this error 我的 Windows Cordova 应用程序中的 ActivateApplication 错误 - Error ActivateApplication in my Windows Cordova application 如何在我的应用程序中找出导致I / O的原因? - how to find out what is causing I/O in my application? 如何确定我的应用程序是在x86还是x64 Windows上运行? - How do I find out if my application is running on x86 or x64 Windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM