phpinfo()mod_rewrite

sha*_*ane 8 mod-rewrite phpinfo

我正在尝试执行一些url重写,在查看phpinfo文件后,我看不到任何提及这个..我的主机是FastHosts.

我应该在寻找其他东西phpinfo()还是我认为这mod_rewrite只是简单的disabled

Emi*_*l H 12

mod_rewrite是一个apache模块,而不是PHP模块.它不可见phpinfo().在某个子文件夹中创建.htaccess并确保它包含:

RewriteEngine on
Run Code Online (Sandbox Code Playgroud)

将浏览器指向该文件夹.如果出现服务器错误,则表明未安装.否则就是.


C.O*_*.O. 8

当PHP被用作Apache模块时,可以使用apache_get_modules()来检查它

<?php
print_r(apache_get_modules());
?>
Run Code Online (Sandbox Code Playgroud)

然后给出这样的结果:

Array
(
   [0] => core
   [1] => http_core
   [2] => mod_so
   [3] => sapi_apache2
   [4] => mod_mime
   [5] => mod_rewrite
)
Run Code Online (Sandbox Code Playgroud)

如果您使用PHP作为CGI,则apache_get_modules()不起作用