【问题标题】:htaccess mod_rewrite cakephp folder inside rulehtaccess mod_rewrite cakephp 文件夹内的规则
【发布时间】:2013-02-25 11:44:22
【问题描述】:

知道mod_rewrite.语法的人的一个小问题

我在域上有一个cakephp app。 .htaccess 文件非常简单:

RewriteEngine on
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]

但我想添加一个目录,我们称它为 "test_dir",这样当我在浏览器中输入domain.com/test_dir/ 时,它会转到test_dir 目录而不是app/webroot/

我试过了,只是在某种程度上成功了,只需要输入

RewriteRule    ^test_dir.$ test_dir/ [L]

但是像这样,因为它是正常的,另一个规则不再是。 那么是否有"if" 声明或类似的声明?

谢谢, 丹尼尔

【问题讨论】:

    标签: cakephp mod-rewrite


    【解决方案1】:
       RewriteRule    ^$ app/webroot/    [L]
    
       RewriteCond    %{REQUEST_URI} !^/test_dir/.*
       RewriteRule    (.*) app/webroot/$1 [L]
    

    【讨论】:

    • 谢谢,在问了这个问题后,我又搜索了一些,找到了rewritecond,但不知道如何正确使用它。谢谢
    猜你喜欢
    • 1970-01-01
    • 2011-07-01
    • 2011-11-16
    • 2011-02-27
    • 1970-01-01
    • 1970-01-01
    • 2016-08-31
    • 1970-01-01
    相关资源
    最近更新 更多