How to hide index.php in url

coldplay.xixi
Release: 2023-03-04 08:22:02
Original
3629 people have browsed it

隐藏url中的index.php的方法:首先设置【'URL_MODEL'=>'2'】;然后根路径下建立一个【.htaccess】;接着将相关代码放到【.htaccess】中保存;最后将配置文件中【#】去除。

How to hide index.php in url

隐藏url中的index.php的方法:

第一步:

'URL_MODEL'=>'2'
Copy after login

第二步:根路径下建立一个.htaccess,可以通过一些软件比如EditPlus去另存为,windows可能不能直接创建

第三步:

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

放到.htaccess中保存

第四步:开启Apache rewrite 模式 去配置文件中 

#LoadModule rewrite_module modules/mod_rewrite.so
Copy after login

去掉前面的#,AllowOverride None改为AllowOverride All ok

当然如果你不是Apache 是IIS就不能这样配了

相关学习推荐:php编程(视频)

The above is the detailed content of How to hide index.php in url. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
url
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