这是的.htaccess code在Word preSS。有人可以解释它是如何工作的? [英] This is the .htaccess code in WordPress. Can someone explain how it works?

查看:262
本文介绍了这是的.htaccess code在Word preSS。有人可以解释它是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是的.htaccess code在Word preSS固定链接。我不明白这是如何工作。有人能解释一下吗?

This is the .htaccess code for permalinks in WordPress. I don't understand how this works. Can someone explain?

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

我用Google搜索,并发现了 -f -d 部分指给真正的目录和文件的优先级更高

I googled and found out that -f and -d part means to give real directories and files higher priority.

但是,那么什么是 ^指数\ .PHP $ - [L] 重写规则。的index.php [L]

如何字preSS工艺分类,标签,网页,并与眼前这个等?

How does WordPress process categories, tags, pages, and etc. with just this?

是否在内部发生的呢?如果是这样,我想学习如何做到这一点在PHP。

Does it happen internally? If so, I'm interested in learning how to do it in PHP.

感谢

推荐答案

^指数\ .PHP $ - [L] prevents为index.php文件的请求被改写,以避免无限循环。如果请求的是index.php的指令不执行任何操作 - 并停止处理规则 [L]

^index\.php$ - [L] prevents requests for index.php from being rewritten, to avoid infinite loops. If the request is for index.php the directive does nothing - and stops processing rules [L].

此块是所有的一个规则,并且说,如果它不是一个真正的文件,而不是一个真正的目录,重新路由请求的index.php。

This block is all one rule, and it says that if it is not a real file and not a real directory, reroute the request to index.php.

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

index.php文件本身除$ P $点是客户端请求的URL(PHP可以看到使用请求的URL $ _ SERVER ['REQUEST_URI'] )和它调用正确的code呈现用户所请求的页面。

index.php itself interprets the URL that was requested by the client (PHP can see the requested URL using $_SERVER['REQUEST_URI']) and it calls the correct code for rendering the page the user requested.

这篇关于这是的.htaccess code在Word preSS。有人可以解释它是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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