使用Word preSS'mod_rewrite规则,要求现有的文件时出现问题规则、文件、问题、preSS

2023-09-02 20:35:06 作者:北栀

请看看我的.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]
 
精彩推荐