![](/img/trans.png)
[英]Is a htaccess file different on apache running on a windows server
[英].htaccess file causing forbidden error in my codeigniter application, I am running apache 24 in my windows server
如果没有 .htaccess 文件,应用程序运行完美,每当我添加 .htaccess 文件时,它显示禁止访问 / 服务器。 我试着输入“测试”。 在 .htaccess 文件的第一行它“显示内部服务器错误”这很好 apache 读取 .htaccess 文件。 但是,每当它立即读取 .htaccess 文件中的“RewriteEngine on”行时,它就会立即显示禁止错误。
这是我的 .htaccess 文件。
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
和 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
文件, .htaccess
文件足以让您的CI
项目启动并运行。DocumentRoot
中提供绝对路径, ${SRVROOT}/htdocs
更改为"F:/xampp/htdocs" -- (your/location/here)
${SRVROOT}
将不起作用,因为您没有写入.php
文件。 有关更多信息,请参阅这些-
这是我的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>
我的.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
希望这对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.