unix - 带有 Apache Directory 和 RewriteRule 的通配符?

标签 unix apache fuelphp

我正在尝试让 FuelPHP 在我的服务器上工作。我无权将 .htaccess 文件用于 RewriteRule。但是,我的主机允许我指定 httpd.conf 文件的一部分。

以下适用于我想要的:

<Directory /Applications/XAMPP/xamppfiles/htdocs/sandbox/username/public>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>

但是,我需要它的作用不仅仅是“用户名”。 如何在此目录中使用通配符,以便它适用于一次性解决方案的任何“用户名”值?

我在 apache manual 上找到了这个建议,但我不知道如何让它与 RewriteRule 一起工作.

尝试了以下但没有奏效:
<Directory /Applications/XAMPP/xamppfiles/htdocs/sandbox/*/public>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>

请帮忙!

最佳答案

你很接近 apache 手册:

<Directory /Applications/XAMPP/xamppfiles/htdocs/sandbox/*/public>


<Directory ~ "/Applications/XAMPP/xamppfiles/htdocs/sandbox/.*/public">

关于unix - 带有 Apache Directory 和 RewriteRule 的通配符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9203354/

相关文章:

C++ 多线程与多台机器

linux - 如何将上下文后的 grep 设置为 "until the next blank line"?

php - 如何从实时服务器上的图像文件夹中获取图像?

python - 尝试使用 mod_wsgi 启动 Pyramid 应用程序时没有名为 deploy 的模块

php - 如何在 Twig 模板中拆分字符?

database - 用于 i18n 的 FuelPHP ORM 数据库模式,意见/建议

python - 如何限制没有终端或多处理库的 python 脚本使用的 CPU 数量?

unix - 永久 chgrp 目录

python - Django 找不到本地安装的 Python 模块

php - 如何检查 PHP 中是否存在定义的常量?