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一样的登陆框. ========================================================= ...
随机推荐
- 【bzoj3624】Apio2008—免费道路
http://www.lydsy.com/JudgeOnline/problem.php?id=3624 (题目链接) 题意 给出一张无向图,其中有0类边和1类边.问能否构成正好有K条0类边的生成树, ...
- 【poj3764】 The xor-longest Path
http://poj.org/problem?id=3764 (题目链接) 今天的考试题,看到异或就有点虚,根本没往正解上想.. 题意 给出一棵带权树,请找出树上的一条路径,使其边上权值的异或和最大. ...
- MyBB \inc\class_core.php <= 1.8.2 unset_globals() Function Bypass and Remote Code Execution(Reverse Shell Exploit) Vulnerability
catalogue . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 MyBB's unset_globals() function ca ...
- lua的corroutine学习
lua的corroutine学习 function receive (prod) local status, value = coroutine.resume(prod) return value e ...
- 单向关系中的JoinColumn
1.person与address的一对一单向关系: 在address中没有特殊的注解. 在Person中对应到数据库里面就有一个指向Address的外键. 我们也可以增加注释指定外键的列的名字,如下: ...
- C#用HttpClient抓取jd.com搜索框下拉数据
添加System.Web.dll引用 添加System.Net.Http引用 using System.Net.Http; using System.Web; string key = "电 ...
- HDU 1007 Quoit Design
传送门 Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Des ...
- Tyvj P1175 机器人
P1175 机器人 时间: 1000ms / 空间: 131072KiB / Java类名: Main 描述 设a,b是给定的正整数.现有一机器人沿着一个有n级的楼梯上下.机器人每上升一次,恰好上升a ...
- codevs 1001 舒适的路线(Kruskal)
传送门 Description Z小镇是一个景色宜人的地方,吸引来自各地的观光客来此旅游观光.Z小镇附近共有N(1<N≤500)个景点(编号为1,2,3,…,N),这些景点被M(0<M≤5 ...
- C语言王国探秘一
我是一个WEB程序员,学习的是PHP.PHP是弱类型语言,学习的过程中,我能预见到以后技术进步的过程中,必然会遇到一些底层的东西.PHP的引擎Zend是C写的,PHP的很多扩展与插件是C写的.Linu ...