gpt4 book ai didi

php - Kohana 3.0 中的 .htaccess 规则?

转载 作者:行者123 更新时间:2023-12-04 06:51:53 25 4
gpt4 key购买 nike

我在本地 apache 服务器上运行 Kohana 设置。我创建了一个“htdocs”文件夹,它在 kohana 目录中存放 index.php 文件。使访问者无法使用系统文件。现在我不想在每次访问另一个 Controller 时从 URL 中删除 index.php,所以我尝试使用提供的 .htaccess 来鬼混,但无法让它工作。这里有人有这方面的技能吗?

.htaccess 文件:

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

该文件放置在 kohana 目录中。显然我只应该改变 RewriteBase 变量,但我不知道它应该是什么

最佳答案

RewriteBase 基本上是到达您所在位置的 URL。

例如,如果 index.php 的 URL 是 http://yoursite/kohana/index.php您将 RewriteBase 设置为/kohana。

你可以在这里找到 mod_rewrite 的文档:http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

关于php - Kohana 3.0 中的 .htaccess 规则?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3000904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com