【发布时间】:2011-04-18 18:44:44
【问题描述】:
这是一个 Apache .htaccess 问题。
在 Kohana PHP 框架(我在 3.1)中,它们似乎不支持控制器或操作的 URL 中的连字符,这是域之后的前 2 个 URL 参数,如下所示:
http://example.com/controller/action
或
http://example.com/blogs/edit-article
有没有一种方法可以让我的 .htaccess 文件从控制器和操作插槽中去除连字符(破折号),但不能从其他插槽中去除?这是我当前的 .htaccess 文件:
Options All +FollowSymLinks -Indexes -Multiviews
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
RewriteRule ^assets/(.*)$ application/views/assets/$1
RewriteCond %{REQUEST_FILENAME} !/application/views/assets/.*
# 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]
【问题讨论】:
标签: php .htaccess frameworks apache2 kohana