Home >Backend Development >PHP Problem >apache hide index.php problem
apache隐藏index.php的方法:首先修改【httpd.conf】配置文件;然后去掉【#】,使rewrite模块生效,并将None改为All;接着在代码项目目录添加【.htaccess】文件;最后确保生效并重启即可。
apache隐藏index.php的方法:
1、修改httpd.conf
配置文件
LoadModule rewrite_module modules/mod_rewrite.so 去掉前面#,
使rewrite 模块生效
修改httpd.conf中所有AllowOverride None 将None
改为 All
2、代码项目目录添加.htaccess
文件
<IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] </IfModule>
确保生效 重启一下即可
相关学习推荐:PHP编程从入门到精通
The above is the detailed content of apache hide index.php problem. For more information, please follow other related articles on the PHP Chinese website!