thinkphp 去掉URL 里面的index.php

例如你的原路径是 http://localhost/test/index.php/home/goods/index.html

那么现在的地址是 http://localhost/test/home/goods/index.html 如何去掉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.确保 config.php  里面配置项 URL_MODEL 设置为 2  return Array(    ‘URL_MODEL‘ => ‘2‘, );

4 .htaccess文件必须放到项目跟目录下 这个文件里面加:

<IfModule mod_rewrite.c>

  RewriteEngine on

  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>

详细见此文:

http://www.cnblogs.com/summerzi/p/3868566.html

thinkphp 去掉URL 里面的index.php

时间: 2024-08-28 04:18:45

thinkphp 去掉URL 里面的index.php的相关文章

thinkphp 去掉URL 里面的index.php(?s=)

例如你的原路径是 http://localhost/test/index.php/home/goods/index.html 那么现在的地址是 http://localhost/test/home/goods/index.html 如何去掉index.php呢?1.httpd.conf配置文件中加载了mod_rewrite.so模块  //在APACHE里面去配置 #LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 2.AllowO

angular 去掉url里面的#

1.适合客户端的方法,但是页面不能刷新,一刷新就404 (1)在index.html里添加 <base href="/"> (2)在app.js的config里,注入$locationProvider,添加 .config(['$locationProvider',function($locationProvider){ $locationProvider.html5Mode('true'); }]) 2.服务器端解决方案(要确保apache中已安装rewrite模块) &

ThinkPHP去掉URL中的index.php

1,先确认你有没mod_rewrite.so模块 /usr/lib/apache2/modules/mod_rewrite.so 然后在httpd.conf最后一行加上(我不加也行,自己都奇怪) LoadModule rewrite_module modules/mod_rewrite.so 重启/etc/init.d/apache2 restart 2,将/etc/apache2/sites-enabled/000-default中的 AllowOverride None 将None改为 Al

ThinkPHP 隐藏URL中的 index.php

去掉 URL 中的 index.php 通常的URL里面含有index.php,为了达到更好的SEO效果可能需要去掉URL里面的index.php ,通过URL重写的方式可以达到这种效果,通常需要服务器开启URL_REWRITE模块才能支持. 例如原来的 URL 为: http://127.0.0.1/index.php/Index/insert 去掉 index.php 之后变为: http://127.0.0.1/Index/insert 第一步:更改Apache的httpd.conf 配置

CI框架apache和nginx环境下面统一去掉路径URL后面的index.php

APACHE: 在apache下去掉url上的index.php折腾了好久 ,一直是访问css ,js,图片文件   you can't access files on server 之类的错误提示,apached的配置上说的是 把 AllowOverride  none 改成  AllowOverride All ,然后allow from all,一直不生效,可以跳转页面,但是样式,js文件,图片都丢失, 发现还是.htaccss的RewriteCond出现了问题,原来是目录不对. 原先的样

nginx去掉url中的index.php

使用情境:我想输入www.abc.com/a/1后,跳转到www.abc.com/index.php/a/1 配置Nginx.conf在你的虚拟主机下添加:  location / {      if (!-e $request_filename){           rewrite ^/(.*)$ /index.php/$1 last;      } } 如果你的项目入口文件在一个子目录内,则: location /目录/ {      if (!-e $request_filename){

PHP CI(CodeIgniter) 如何去掉url中的index.php

1.打开Apache配置文件httpd.conf,找到 1 #LoadModule rewrite_module modules/mod_rewrite.so 去掉前面的# 搜索AllowOverride,将相应Directory下的AllowOverride设置为All 1 AllowOverride All 2.在CI的根目录下,建立.htaccess文件,文件内容如下 1 RewriteEngine On 2 3 RewriteCond %{REQUEST_URI} ^system.* 4

thinkphp框架url中隐藏index.php

1.httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置 #LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 2.在apache配置文件httpd.conf中,将里面的AllowOverride None都改为AllowOverride All 进行1和2之后,一定要重启apache服务 3..htaccess文件必须放到根目录下 (windows里面创建.htaccess,新建任何一个

ThinkPHP5 隐藏接口里面的index.php

隐藏index.php 官方介绍是这样的:http://www.kancloud.cn/thinkphp/thinkphp5_quickstart/145250 可以去掉URL地址里面的入口文件index.php,但是需要额外配置WEB服务器的重写规则. 以Apache为例,需要在入口文件的同级添加.htaccess文件(官方默认自带了该文件),内容如下: <IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteE