Wordpress如何在没有重写映射的情况下重写URL? [英] How does Wordpress rewrite the URL without a rewrite map?

查看:62
本文介绍了Wordpress如何在没有重写映射的情况下重写URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

wordpress网站的.htaccess文件如下所示:

The .htaccess file for a wordpress site looks something like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

...并且htdocs中没有设置重写映射.这是如何运作的? Apache如何知道如何重写这些URL?

...and there is no rewrite map set in htdocs. How does this work? How does Apache know how to rewrite these url?

推荐答案

Apache不知道.所有请求都发送到index.php,Wordpress保留要重定向到哪个页面的内部日志,并将其重定向.因此,从本质上讲,WordPress实际上在.htaccess中有两组重写规则,一组在内部,另一组是贪婪的"外部规则,这基本上使所有请求都引用了内部重写规则.

The Apache does not know. All the requests are sent to index.php and Wordpress keeps an internal log of which page to redirect where, and it redirects it. So, in essence, Wordpress actually has two sets of rewrite rules, one internally and a "greedy" external rule in your .htaccess which basically makes all requests refer to the internal rewrite rules.

您可能有兴趣使用此插件显示了Wordpress自身所做的所有内部重写.

You may be interested in using this plugin which shows all the internal rewrites that Wordpress is doing itself.

这篇关于Wordpress如何在没有重写映射的情况下重写URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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