【问题标题】:Wordpress - Permalinks and folders (.htaccess ?)Wordpress - 永久链接和文件夹 (.htaccess ?)
【发布时间】:2011-09-15 09:03:49
【问题描述】:

我有一个带有帖子名称的永久链接的 Wordpress 网站。现在我在特定页面上有一个新模板,它使用来自完全相同 url 路径的文件,我无法更改它。 如何让 Wordpress 访问我请求的页面 (example.com/meniu/) 并忽略同名的文件夹名称? (example.com/menu/swf/)

谢谢!

这是我的 .htaccess。如何添加排除项?

<IfModule mod_rewrite.c> 
RewriteEngine On 

RewriteBase /club/ 
RewriteRule ^index\.php$ - [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /club/index.php [L] 

</IfModule> 

【问题讨论】:

  • TBH 我不明白需要做什么。请您改述一下您的问题或解释清楚一点好吗?
  • 我在 Wordpress 中有一个名为“菜单”的页面。在服务器上,我有一个名为“menu”的文件夹。现在,Appache 给了我文件夹的内容而不是 wordpress 页面,女巫是用 wordpress 制作的永久链接 htaccess 制作的。
  • 显示您当前的 .htaccess -- 需要修改规则以允许此类“排除”。但理想情况下,最好重命名该文件夹...或更改帖子名称/永久链接。
  • &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase /club/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /club/index.php [L] &lt;/IfModule&gt; 这是我的 .htaccess。如何添加排除项?
  • 这是我的 .htaccess。如何添加排除项?

标签: wordpress .htaccess mod-rewrite url-rewriting


【解决方案1】:

您可以预先添加另一个规则以仅排除该目录:

RewriteCond %{REQUEST_URI}  ^/menu
RewriteRule . /club/index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /club/index.php [L]

【讨论】:

  • 谢谢!我会尽快检查。我设法通过一个目录和一个 index.php 文件解决了这个问题,其中我包含了 wp-load 文件,然后是主题页眉和页脚,然后是嵌入的 flash 文件。非常感谢,我相信我很快就会需要这个!
猜你喜欢
  • 1970-01-01
  • 2023-03-14
  • 1970-01-01
  • 1970-01-01
  • 2017-05-03
  • 2012-12-21
  • 2011-01-10
  • 1970-01-01
  • 2013-03-25
相关资源
最近更新 更多