Home  >  Article  >  Backend Development  >  How to remove index.php in wamp

How to remove index.php in wamp

藏色散人
藏色散人Original
2021-06-16 09:25:391524browse

wamp去掉index.php的方法:1、在httpd.conf配置文件中加载mod_rewrite.so模块;2、将None改为All;3、将URL_MODEL设置为2;4、将htaccess文件放到根目录下。

How to remove index.php in wamp

本文操作环境:windows7系统、PHP7.1版,DELL G3电脑

wamp怎么去掉index.php?WAMP中 省略index.php

1.httpd.conf配置文件中加载了mod_rewrite.so模块  //在APACHE里面去配置

#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉

2.AllowOverride None 讲None改为 All      //在APACHE里面去配置 (注意其他地方的AllowOverride也统统设置为ALL)

<Directory "D:/server/apache/cgi-bin">
AllowOverride none  改   AllowOverride ALL
Options None
Order allow,deny
Allow from all
</Directory>

3.确保URL_MODEL设置为2,在项目的配置文件里写

return Array(
   &#39;URL_MODEL&#39; => &#39;2&#39;,
);

4 .htaccess文件必须放到跟目录下

这个文件里面加:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

 

推荐学习:《PHP视频教程

The above is the detailed content of How to remove index.php in wamp. 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