ThinkPHP通过URL重写隐藏应用的入口文件index.php

WBOY
Release: 2016-06-23 13:39:29
Original
1528 people have browsed it

我用的是apache


[ Apache ]

httpd.conf配置文件中加载了mod_rewrite.so模块,去掉#号。 AllowOverride None 将None改为 All,所有的都修改不然会报404。 把项目URL模式设置为2。'URL_MODEL' => 2, 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下

<IfModule mod_rewrite.c>  RewriteEngine on  #如果目录存在就直接访问目录不进行RewriteRule   RewriteCond %{REQUEST_FILENAME} !-d  #如果文件存在,就直接访问文件,不进行下面的RewriteRule.(不是文件或文件不存在就执行重写)   RewriteCond %{REQUEST_FILENAME} !-f  #所有找不着实际路径的文件,统一交给index.php处理   RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule> 
Copy after login



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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!