【问题标题】:How to use mod_rewrite without clashing with Wordpress如何在不与 Wordpress 冲突的情况下使用 mod_rewrite
【发布时间】:2014-12-11 03:44:47
【问题描述】:

所以我安装了 Wordpress,让我们调用域 test.com。 wordpress 在默认目录(比 wp-content 高一级)中创建的 .htaccess 是

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

我想添加另一个规则,如果触发,应该让 Wordpress 不重写。例如,假设我希望 test.com/nochange 重定向到 test.com/script.php,而不是执行正常的 Wordpress 重定向。通常这个 .htaccess 会是

RewriteRule ^nochange$ ./script.php [NC,L]

但是,无论如何,Wordpress 最终都会运行,当然会出现 404 not found 的情况。如果我删除了 Wordpress .htaccess 组件,一切正常。我该怎么做才能让他们一起工作?

【问题讨论】:

    标签: wordpress apache mod-rewrite


    【解决方案1】:

    啊,我只需要使用 END 标记。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-26
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多