[英].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>
httpd.conf
file, .htaccess
file is enough to make your CI
project up and running.httpd.conf
文件, .htaccess
文件足以让您的CI
项目启动并运行。DocumentRoot
ie change ${SRVROOT}/htdocs
to "F:/xampp/htdocs" -- (your/location/here)
DocumentRoot
中提供绝对路径, ${SRVROOT}/htdocs
更改为"F:/xampp/htdocs" -- (your/location/here)
${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.