如何检查php中是否启用了mod_rewrite?我想知道是否有可能mod_rewrite启用阿帕奇和IIS在……里面PHP.ModRewrite因为IIS存在。检查一下here.所以,我正在寻找一个PHP脚本来检查mod_rewrite在……上面阿帕奇和IIS有没有人知道这样的剧本,或者会写剧本?尤其是对于微软IIS.谢谢!
3 回答

茅侃侃
TA贡献1842条经验 获得超21个赞
apache_get_modules()
mod_rewrite
in_array('mod_rewrite', apache_get_modules());
strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false
true
mod_write

温温酱
TA贡献1752条经验 获得超4个赞
复制这段代码并运行以找出答案。
<?php
if(!function_exists('apache_get_modules') ){ phpinfo(); exit; }
$res = 'Module Unavailable';
if(in_array('mod_rewrite',apache_get_modules()))
$res = 'Module Available';
?>
<html>
<head>
<title>A mod_rewrite availability check !</title></head>
<body>
<p><?php echo apache_get_version(),"</p><p>mod_rewrite $res"; ?></p>
</body>
</html>

撒科打诨
TA贡献1934条经验 获得超2个赞
### .htaccess<IfModule mod_rewrite.c> # Tell PHP that the mod_rewrite module is ENABLED. SetEnv HTTP_MOD_REWRITE On RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # The rest of your rewrite rules here</IfModule>
array_key_exists('HTTP_MOD_REWRITE', $_SERVER);
- 3 回答
- 0 关注
- 387 浏览
添加回答
举报
0/150
提交
取消