Heim  >  Artikel  >  Backend-Entwicklung  >  thinkphp暗藏中url的index.php

thinkphp暗藏中url的index.php

WBOY
WBOYOriginal
2016-06-13 12:12:24807Durchsuche

thinkphp隐藏中url的index.php

在本地进行测试

1.修改apache配置文件将如下代码#去掉

<span style="color: #008000;">#</span><span style="color: #008000;">LoadModule rewrite_module modules/mod_rewrite.so</span>

 

 

在index.php 目录下新建文件.htaccess文件

<ifmodule mod_rewrite.c><span style="color: #000000;">RewriteEngine onRewriteCond </span>%{REQUEST_FILENAME} !-<span style="color: #000000;">dRewriteCond </span>%{REQUEST_FILENAME} !-<span style="color: #000000;">fRewriteRule </span>^(.*)$ index.php/$1 [QSA,PT,<span style="color: #000000;">L]</span></ifmodule>

 

在配置文件config.php修改URL模式

'URL_MODEL'=>2,

 

 

在万网UNIX虚拟主机,开放了PHP-Rewrite功能官网提供了一个测试的小程序http://help.www.net.cn/knowledge_detail.htm?spm=5334.7618386.5.1.0T8ePV&knowledgeId=5868355&keyWords=unix%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BAphp-rewrite%E6%B5%8B%E8%AF%95%E7%A8%8B%E5%BA%8F&categoryId=8311139

万网虚拟主机设置方法与在本地设置相同

 

 

 

 

 

 

 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn