zoukankan      html  css  js  c++  java
  • URL_MODEL 2 不能访问 在APACHE服务器上的访问方式上去除index.php

    thinkphp URL_MODEL=2,访问链接http://i.cnblogs.com/Online/index.html  报错:

    Not Found

    The requested URL /online/index.html was not found on this server.

    =0的访问http://i.cnblogs.com/index.php/Home/Test/test

    改为2,去掉了index.php,并且实现了伪静态(URL重写)。

    重写方法:1、配置config.php

    /* URL配置 */
    'URL_CASE_INSENSITIVE' => false, // 默认false 表示URL区分大小写 true则表示不区分大小写
    'URL_MODEL' => 2, // URL模式
    'URL_PATHINFO_DEPR' => '/', // PATHINFO URL分割符
    'URL_ROUTER_ON' => false, // 是否开启URL路由
    'URL_ROUTE_RULES' => array(), // 默认路由规则 针对模块

         2、配置apache,目录及文件:apacheApache2.2.21confhttpd.conf

            查找mod_rewrite.so

             找不到添加   LoadModule rewrite_module modules/mod_rewrite.so

             找到了,把前面的#去掉(取消注释)

           3、重启apache   /usr/local/apache/bin/apachectl restart

         4、新建.htaccess文件

    <IfModule mod_rewrite.c>
      Options +FollowSymlinks
      RewriteEngine On

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

  • 相关阅读:
    swift 图像的压缩上传
    swift UILabel加载html源码
    UITableViewCell上面添加UIWebView
    iOS 富文本点击事件
    iOS 导航栏 不透明
    【异步编程】理解异步
    使用 Git Bash
    【选择符 API】querySelector() 方法
    Vue 模板语法-指令
    Vue 模板语法-插值
  • 原文地址:https://www.cnblogs.com/itslives-com/p/URL_MODEL2.html
Copyright © 2011-2022 走看看