mod_rewrite vs mod_rewrite.c,有区别吗?

时间:2015-08-12 06:48:45

标签: wordpress apache .htaccess mod-rewrite

这是wordpress .htaccess文件:

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

# END WordPress

<IfModule mod_rewrite.c></IfModule>是否检查服务器上是否已加载mod_rewrite模块?如果<IfModule mod_rewrite.c></IfModule>用于mod_rewrite,那么为什么<IfModule mod_rewrite.c></IfModule>使用mod_rewrite代替mod_rewrite.c?它是指提到here的源文件:

enter image description here

2 个答案:

答案 0 :(得分:1)

您可以在此处阅读:http://httpd.apache.org/docs/2.4/en/mod/core.html#ifmodule

语法:

<IfModule [!]module-file|module-identifier> ... </IfModule>

对于Apache Module mod_rewrite,它是mod_rewrite.crewrite_module

答案 1 :(得分:1)

http://httpd.apache.org/docs/current/mod/core.html#ifmodule

  

<IfModule test>...</IfModule>部分用于标记指令   这取决于是否存在特定模块。该   部分中的指令仅在测试时处理   是真的。如果测试为假,则开始和结束之间的所有内容   标记被忽略。

     

模块参数可以是模块标识符,也可以是文件   模块的名称,在编译时。例如,   rewrite_module是标识符,mod_rewrite.c是文件名。

http://httpd.apache.org/docs/2.2/mod/module-dict.html#SourceFile

  

源文件

     

这简单地列出了包含的源文件的名称   模块的代码。这也是<IfModule>使用的名称   指令。

在外行中是的,IfModule条件检查模块是否已加载。是的mod_rewrite.c是源文件。