Home  >  Article  >  Backend Development  >  apache hide index.php problem

apache hide index.php problem

coldplay.xixi
coldplay.xixiOriginal
2020-07-24 11:47:382627browse

apache隐藏index.php的方法:首先修改【httpd.conf】配置文件;然后去掉【#】,使rewrite模块生效,并将None改为All;接着在代码项目目录添加【.htaccess】文件;最后确保生效并重启即可。

apache hide index.php problem

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn