【问题标题】:Mod-rewrite for domain except one directory除一个目录外的域的Mod-rewrite
【发布时间】:2012-08-09 18:34:46
【问题描述】:

我是 htaccess 的新手,无法弄清楚这里发生了什么。我正在尝试使用 PAGEID=pageName 将所有重定向指向 index.php。

因此,domain.com/manager 将被推送到 index.php?PAGEID=manager。

现在,我有这个工作,但我需要它在它到达目录“test”时正常运行,但每当我转到 domain.com/test 时,我都会被推送到 index.php?PAGEID=test

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/test
RewriteRule ^([\w/]*)$ index.php?PAGEID=$1 [L]

关于如何使它工作的任何想法?我错过了什么?

【问题讨论】:

    标签: .htaccess mod-rewrite


    【解决方案1】:

    我认为这个逻辑有一些问题。因为在这个例子'domain.com/test'中,我们写了一个条件,将domain.com之后的所有字符串(测试)替换为'index.php?pageid=test'。

    问题是 'index.php' 在 domain 'domain.com/index.php?pageid..' 之后也是一个字符串。这里也将适用重写条件并将其重写。

    我认为你应该尝试这样的事情。 htaccess, redirect virtual subdomain to URL parameter

    或者如果'test'是一个静态字符串,那么在重写条件下我们可以指定只替换字符串'test'到'index.php/pageid=test'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-21
      • 1970-01-01
      • 1970-01-01
      • 2012-12-29
      • 1970-01-01
      • 2011-12-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多