Home > Backend Development > PHP Tutorial > thinkphp 去除index.php

thinkphp 去除index.php

WBOY
Release: 2016-06-13 12:36:52
Original
1193 people have browsed it

thinkphp 去掉index.php

去掉URL里面的index.php?是为了SEO的需要,需要服务器开启URL_REWRITE模块。
下面的配置过程可以参考下:
1 ?httpd.conf配置文件中加载了mod_rewrite.so模块

??#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉
2??AllowOverride?None?将None改为?All

?

? ? AllowOverride All

? ? Options None

? ? Order allow,deny

? ? Allow from all

3 ?确保URL_MODEL设置为2

?return Array(
? ? ?'URL_MODEL' => '2',
? );

4 把.htaccess文件放到入口文件的同级目录下(路径为phpmyadmin\libraries)

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

ps:在windows下不能建立以点开头的文件,你可以先随便建立一个文件

然后在DOS在操作 rename xxxx.xxxx?? .htaccess

?

1 楼 Jocson 2011-11-22  
不知道我的为什么还是行啊,已经按照你写的操作了啊,能详细说明一下吗,帮我改正一下。

2 楼 Jocson 2011-11-22  
[img][/img] thinkphp 去除index.php

3 楼 zhong871004 2011-12-31  
Jocson 写道
[img][/img] thinkphp 去除index.php
你的问题出在哪里了
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