index : index在互联网上表示网站的默认主页。
一般为 index.html index.htm index.asp index.php;
另外的默认主页也多用default.html;default.htm等。
RewriteCond : RewriteCond指令定义一条规则条件。在一条RewriteRule指令前面可能会有一条或多条RewriteCond指令,只有当自身的模板(pattern)匹配成功且这些条件也满足时规则才被应用于当前URL处理。
RewriteRule : 它还可以实现限制特定IP访问网站的功能。比如原本需要http://www.abc.com/read.php?tid=123 通过Rewriterule 变成哦 http://www.abc.com/123.htm也可以访问。
0、这方面在一些博客或者论坛的网站上利用比较多,比如cnbate,比如PHPWIND等一些访问量高又希望友好亲和搜索引擎的站点一般会利用伪静态技术来完成。
Rewri。
mod_rewrite : mod_rewrite是Apache的一个模块。
Directory : 用于典型操作,如复制、移动、重命名、创建和删除目录。[1]。

本节内容:
PHP单一入口

在apache配置文件httpd.conf加入,去掉LoadModule rewrite_module modules/mod_rewrite.so前面的“#”号。

内容:

代码示例:

DocumentRoot /

<Directory />
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    #AllowOverride All
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /
  #不显示index.php

RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule  ^/?(.*)$ /index.php?%{QUERY_STRING} [L,NC]
  #RewriteRule ^(.*)$ index.php?$1 [QSA,L]
 </IfModule>
DirectoryIndex index.php index.html index.htm
</Directory>

我的个人设置:

<Directory "D:/xampp/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI #
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All #
# Controls who can get stuff from this server.
#
Require all granted
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
#不显示index.php RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)$ /index.php?%{QUERY_STRING} [L,NC]
#RewriteRule ^(.*)$ index.php?$ [QSA,L]
</IfModule>
</Directory>

PHP单一入口apache配置和去除index.php的更多相关文章

  1. PHP 实现单一入口 apache配置

    在apache的httpd.conf加入,需要把LoadModule rewrite_module modules/mod_rewrite.so前面的“#”去掉 DocumentRoot / < ...

  2. CentOs中Apache文件访问去除index.php

    0.apache下面和index.php同一个目录下面的 .haccess <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{ ...

  3. 在APACHE服务器上的访问方式上去除index.php

      在APACHE服务器上的访问方式上去除index.php   下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 例如: 你原来的路径是: localhost/index ...

  4. ThinkPHP在Apache和Nginx下去除index.php方法

    由于项目需要,用ThinkPHP开发的程序链接要去除index.php下面说下如何解决.一.Nginx方法 由于nginx不支持PATH_INFO,所以需要进入linux终端找到nginx 的配置文件 ...

  5. apache配置Options详解

    http://www.365mini.com/page/apache-options-directive.htm Options指令是Apache配置文件中一个比较常见也比较重要的指令,Options ...

  6. Apache 配置虚拟域名的最简单方式

    一.配置httpd.conf: 1.取消Include conf/extra/httpd-vhosts.conf的注释,代码如下: # Virtual hostsInclude conf/extra/ ...

  7. webpack4 单入口文件配置 多入口文件配置 以及常用的配置

    单入口文件配置 webpack.config.js const path = require('path'); const HtmlWebpackPlugin = require('html-webp ...

  8. Apache 配置多站点访问「为项目分配二级域名」

    一级域名(baidu.com)也叫作顶级域名,注册一级域名是需要付费的. 而二级域名(image.baidu.com)是一级域名的延伸,所以只要购买了一级域名,二级域名是可以任意配置的. 其实(www ...

  9. Apache配置--用户认证(针对目录访问)-update2015-05-02

    通过Apache配置可以限制用户对目录的访问,会弹出像phpadmin一样的登陆框. ========================================================= ...

随机推荐

  1. Linux安装pdo_mysql模块

    网站不能访问 查看apache日志 PHP Fatal error: Uncaught exception 'PDOException' with message 'could not find dr ...

  2. 数据结构作业——word(栈)

    Description TonyY 是一个 word 小白,今天他对 word 中撤销和恢复功能特别感兴趣,玩耍了一个上午(mdzz~) ,现在他知道了它们的功能和快捷键:撤销:ctrl+z,可以撤销 ...

  3. mysql 生成排名字段

    假设有test表,下图为表机构和数据,score表示积分.现在要查询积分排名为第几的id?? 查询语句 select id,score,(@rowno:=@rowno+1) as rowno from ...

  4. Emmet (Zen Coding) 官方文档中HTML语法的总结

    1. 嵌套操作---------- 子操作: > div>ul>li <div> <ul> <li></li> </ul> ...

  5. 机器学习笔记--KNN算法2-实战部分

    本文申明:本系列的所有实验数据都是来自[美]Peter Harrington 写的<Machine Learning in Action>这本书,侵删. 一案例导入:玛利亚小姐最近寂寞了, ...

  6. php返回json数据中文显示的问题

    PHP5.4版本,已经给Json新增了一个选项: JSON_UNESCAPED_UNICODE.加上这个选项后,就不会自动把中文编码了. echo json_encode("厦门" ...

  7. 转:netflix推荐系统竞赛

    原文链接:Netflix recommendations: beyond the 5 stars (Part 1), (Part 2) 原文作者:Xavier Amatriain and Justin ...

  8. TCP/UDP端口列表

    http://zh.wikipedia.org/wiki/TCP/UDP%E7%AB%AF%E5%8F%A3%E5%88%97%E8%A1%A8 TCP/UDP端口列表     本条目可通过翻译外语维 ...

  9. 第二轮冲刺-Runner站立会议02

    今天做了什么:查看gridview与baseadapter适配器 遇到的困难:继续gridview与baseadapter适配器 明天准备做什么:没有弄懂gridview与baseadapter适配器 ...

  10. thinkphp新增

    $m = M('content'); //与   $m = new Model('content')效果一样 $date = array( 'username' => I('username', ...