【问题标题】:Hide a recurring folder隐藏重复文件夹
【发布时间】:2011-12-12 20:41:19
【问题描述】:

由于某种原因,我不断在我的服务器上生成一个名为“blog”的空文件夹。不知道为什么,我在 WP.org 论坛上问过,但无济于事 - http://wordpress.org/support/topic/directory-being-created?replies=14

这搞砸了我漂亮的永久链接,因为 /blog 的链接没有显示我的博客,它只显示一个空文件夹。

在我等待解决问题的同时,有没有办法让 .htaccess 将博客文件夹 url 转发到我的实际博客页面?

当前.htaccess 下面:

RewriteEngine on

# 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 中创建了一个名为“博客”的页面?

标签: apache wordpress .htaccess directory permalinks


【解决方案1】:

修改您的 .htaccess 以包含以下内容

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
#if it is the blog folder also send it to WordPress
RewriteCond %{REQUEST_URI} ^/blog/?
RewriteRule . /index.php [L]

【讨论】:

  • 太棒了。我很生气,几个月前我没想到!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-02-06
  • 2015-04-06
  • 2018-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多