使用Word preSS'mod_rewrite规则,要求现有的文件时出现问题 [英] Problems with Wordpress’ mod_rewrite rules when requesting existing files

查看:149
本文介绍了使用Word preSS'mod_rewrite规则,要求现有的文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看看我的.htaccess:

please take a look at my .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

对于Word preSS它工作正常。

For Wordpress it works fine.

不过,我有一个问题:我有一个名为目录的的,用于交换链接,无关的话语preSS博客。 现在,我无法访问我的的目录中,它重定向我一个字preSS职位。 为什么呢?

But I have a problem: I have a directory called lo, used for links exchange, has nothing to do with the Wordpress blog. Now, I can't access my lo directory, it redirects me to a wordpress post. Why?

推荐答案

确实 / LO / 的DirectoryIndex /lo/index.php

如果是这样,假设你的答案佩卡的问题是是的,这个问题可能从第四起源重写规则。一个请求到 / LO / 映射到 /lo/index.php ,它匹配

If so, and assuming your answer to Pekka's question is "Yes", the problem likely originates from the fourth RewriteRule. A request to /lo/ maps to /lo/index.php, which matches

RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

...并获取您的网站的根,这是道preSS文件重写的index.php 。我不知道这个规则的要点是(它确实为Word preSS块访问的.php 的文件,但在那种超一般的方式) ,所以我不知道的最好的建议是什么条件,但可以如下:

...and gets rewritten to index.php in your site root, which is the WordPress file. I'm not sure what the point of this rule is (it does block access to WordPress .php files, but in kind of a super-general way), so I don't know what the best recommendation is for conditioning it, but the following would work:

RewriteCond %{REQUEST_URI} !^/lo
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

这篇关于使用Word preSS'mod_rewrite规则,要求现有的文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆