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. 【BZOJ-4386】Wycieczki DP + 矩阵乘法

    4386: [POI2015]Wycieczki Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 197  Solved: 49[Submit][Sta ...

  2. 【poj3261】 Milk Patterns

    http://poj.org/problem?id=3261 (题目链接) 题意 给出n个数和k,求在给出的数中,最长的出现至少k次的可重叠子串. solution 后缀数组论文题,感觉分组思想可能会 ...

  3. 对WEB标准以及W3C的理解与认识

    按照习惯的理解,这两个概念似乎都是指的一个东西(就是咱们在这个版里讨论的这些个"高深理论“^_^).但我认为,事实上从技术的角度上讲,这两个事物几乎没有任何相关性.web标准简而言之就是将页 ...

  4. CTO、技术总监、首席架构师的区别

    2016年11月30日13:22:26[转] CTO.技术总监.首席架构师的区别 提升自已的能力,比如专业技术,行业发展趋势,技术发展趋势,协调能力,组织能力,管理能力等[技术总监] 需要从技术总监和 ...

  5. OpenCV: imshow后不加waitkey无法显示视频

    OpenCV显示视频帧时出现一个问题,就是imshow之后若是不加waitkey则无法显示,找了很久也没找到原因. 只是发现也有人发现这个问题:   cvWaitKey(x) / cv::waitKe ...

  6. linux 学习基础7之脚本的练习

    练习:传递一个用户名参数给脚本,判断此用户的用户名跟其基本组的组名是否一致,并将结果显示出来.写一个脚本:#!/bin/bashUSER=$1if [ !  $# -eq 1 ];then  echo ...

  7. LABjs(类似于LazyLoad,但它更加方便管理依赖关系)

    动态加载JS函数 一般性的,当我们需要加载js文件的时候都会使用script标签来实现,类似于如下代码: <script type="text/javascript" src ...

  8. UVA11178 Morley's Theorem(基础模板)

    题目链接 题意:给出A,B, C点坐标求D,E,F坐标,其中每个角都被均等分成三份   求出 ABC的角a, 由 BC 逆时针旋转 a/3 得到BD,然后 求出 ACB 的角a2, 然后 由 BC顺时 ...

  9. uC/OS-II中includes块

    /*************************************************************************************************** ...

  10. asp.net json 与xml 的基础事例

    //json序列化和反序列化 using System.Runtime.Serialization.Json; public static string JsonSerializer<T> ...