Home > Backend Development > PHP Problem > apache hide index.php problem

apache hide index.php problem

coldplay.xixi
Release: 2023-03-03 08:56:01
Original
2662 people have browsed it

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>
Copy after login

确保生效 重启一下即可

相关学习推荐: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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template