【问题标题】:Wordpress permalinks (mod rewrite)Wordpress 永久链接(mod 重写)
【发布时间】:2011-03-30 15:55:34
【问题描述】:

我正在尝试让 Wordpress 在目录 (/blog) 中启动并运行,但由于根目录中有一个 .htaccess 文件,我认为当我打开永久链接时它会发生冲突。当我尝试访问诸如 http://www.domain.com/blog/2011/03/article-name/ 之类的页面时,我得到了 404。但是,我可以访问 http://www.domain.com/blog/

这是根目录中的 .htaccess:

RewriteEngine On
RewriteBase /

#If not valid file send request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

这是 /blog 目录中的 .htaccess:

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

有什么办法可以修复 wordpress 永久链接吗?我可以访问这两个 .htaccess 文件(如果解决方案需要编辑根目录中的那个)..

【问题讨论】:

  • 最后一条规则很奇怪。我会设置^.*$。关于冲突,mydomain.com/blog/blablabla 返回什么? / 的索引 ??

标签: wordpress mod-rewrite


【解决方案1】:

您是否尝试过在根 .htaccess 文件中注释掉与 WordPress 相关的内容?如果 WP 安装在子目录中,我相信 .htaccess 文件应该完成所有工作

【讨论】:

  • 主站需要根目录下的重写条件和规则(都是非wordpress相关的)。可能是我需要做一个规则,说只有在目录不是 /blog 时才应用它们..
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-20
  • 2017-09-19
  • 1970-01-01
  • 2011-11-18
  • 1970-01-01
相关资源
最近更新 更多