PHP单一入口apache配置和去除index.php
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的更多相关文章
- PHP 实现单一入口 apache配置
在apache的httpd.conf加入,需要把LoadModule rewrite_module modules/mod_rewrite.so前面的“#”去掉 DocumentRoot / < ...
- CentOs中Apache文件访问去除index.php
0.apache下面和index.php同一个目录下面的 .haccess <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{ ...
- 在APACHE服务器上的访问方式上去除index.php
在APACHE服务器上的访问方式上去除index.php 下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 例如: 你原来的路径是: localhost/index ...
- ThinkPHP在Apache和Nginx下去除index.php方法
由于项目需要,用ThinkPHP开发的程序链接要去除index.php下面说下如何解决.一.Nginx方法 由于nginx不支持PATH_INFO,所以需要进入linux终端找到nginx 的配置文件 ...
- apache配置Options详解
http://www.365mini.com/page/apache-options-directive.htm Options指令是Apache配置文件中一个比较常见也比较重要的指令,Options ...
- Apache 配置虚拟域名的最简单方式
一.配置httpd.conf: 1.取消Include conf/extra/httpd-vhosts.conf的注释,代码如下: # Virtual hostsInclude conf/extra/ ...
- webpack4 单入口文件配置 多入口文件配置 以及常用的配置
单入口文件配置 webpack.config.js const path = require('path'); const HtmlWebpackPlugin = require('html-webp ...
- Apache 配置多站点访问「为项目分配二级域名」
一级域名(baidu.com)也叫作顶级域名,注册一级域名是需要付费的. 而二级域名(image.baidu.com)是一级域名的延伸,所以只要购买了一级域名,二级域名是可以任意配置的. 其实(www ...
- Apache配置--用户认证(针对目录访问)-update2015-05-02
通过Apache配置可以限制用户对目录的访问,会弹出像phpadmin一样的登陆框. ========================================================= ...
随机推荐
- [bzoj1618][Usaco2008 Nov]购买干草
Description 约翰的干草库存已经告罄,他打算为奶牛们采购磅干草. 他知道个干草公司,现在用1到给它们编号.第个公司卖的干草包重量为磅,需要的开销为美元.每个干草公司的货源都十分充 ...
- Leetcode 226. Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 class Solution(object): ...
- 【poj2942】 Knights of the Round Table
http://poj.org/problem?id=2942 (题目链接) 题意 有n个骑士要去参加圆桌会议,他们将围成一圈,想要他们不打架,当且仅当参加圆桌会议的骑士数为奇数并且相邻的两个骑士不互相 ...
- UOJ20 解方程
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...
- JSP_通过表格显示数据库的信息
在本篇文章中,小编将介绍在jsp页面中通过表格显示数据库的实现:下面我们以“新闻发布系统”中显示一级标题的信息为例进行讲述,在新闻发布系统中存在一二级标题,在后台可以对标题进行管理,可查询标题等信息 ...
- Linux UserSpace Back-Door、Rootkit SSH/PAM Backdoor Attack And Defensive Tchnology
catalog . 引言 . Pam后门 . SSH后门 . Hijacking SSH . Hijacking SSH By Setup A Tunnel Which Allows Multiple ...
- Hong Kong Regional Online Preliminary 2016 C. Classrooms
Classrooms 传送门 The new semester is about to begin, and finding classrooms for orientation activities ...
- python函数(五)
函数 1.函数基本语法及特性 背景提要 现在老板让你写一个监控程序,监控服务器的系统状况,当cpu\memory\disk等指标的使用量超过阀值时即发邮件报警, 你掏空了所有的知识量,写出了以下代码 ...
- shell text process code
shell 命令处理文本: 1. 批量处理该目录下的文件,ls | while read l ; do echo $l ; done > b.txt 2. 批量处理文件的每一行 , cut - ...
- zabbix 3.0快速安装简介(centos 6)
zabbix快速安装 系统版本:centos 6 1.yum源配置和zabbix.msyql安装 rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3. ...