0.apache下面和index.php同一个目录下面的 .haccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=/$ [QSA,PT,L]
</IfModule>

1.centos的配置文件放在: /etc/httpd/conf/httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

将前面"#"去掉,如果不存在则添加上句。

2.如果你的网站是根目录的话:找到

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

将上面的None改为All

3.如果你的站点不在根目录,设置如下:

<Directory "/var/www/html/my_directory">
  Order allow,deny
  Allow from all
  AllowOverride All
</Directory>

然后重启服务器,service httpd restart ,这样.htaccess就可以使用了

4.index.php (thinkphp3.2.3版本)

define('__APP__', ''); //将index.php自动隐藏

CentOs中Apache文件访问去除index.php的更多相关文章

  1. centos中apache自用常用额外配置记录(xwamp)

    xwamp套件中apache配置,记录下,以免忘记. 配置路径 ${wwwroot_dir}/conf/httpd.conf 配置内容 <ifmodule mod_deflate.c> D ...

  2. CentOS中Apache虚拟主机(virtualHost)设置在/home目录下的若干问题

    在Ubuntu中安装LAMP是非常简单的意见事情.但是在CentOS中却遇到了很多问题. 首先是CentOS中必须手动配置iptables,把80端口开放出来,不然,是访问不到的,开放80端口在/et ...

  3. Linux中ls -l(ll)返回结果中的文件访问权限-rw-r--rw-

    linux文件访问权限(像rw-r--rw-是什么意思)   Linux的文件访问权限分为 读.写.执行三种 r:可读(4) w:可写(2)对目录来说则可新建文件 x:可执行(1)对目录来说则可进入该 ...

  4. centos7 centos中apache运行php需要连接mysql一直连不上,telnet访问mysql出错Connection closed by foreign host

    执行命令: getsebool -a|grep httpd 发现 httpd_can_network_connect off 解决:  setsebool httpd_can_network_conn ...

  5. PHP单一入口apache配置和去除index.php

    index : index在互联网上表示网站的默认主页. 一般为 index.html index.htm index.asp index.php: 另外的默认主页也多用default.html;de ...

  6. 【转】CentOs中Apache开启rewrite模块详解

    rewrite是apache环境的一个伪静态功能了,如果我们没有没让Apache开启rewrite功能,网站上所有的rewrite规则都不可使用. centos的配置文件放在: /etc/httpd/ ...

  7. 解析centos中Apache、php、mysql 默认安装路径

    apache:如果采用RPM包安装,安装路径应在 /etc/httpd目录下apache配置文件:/etc/httpd/conf/httpd.confApache模块路径:/usr/sbin/apac ...

  8. centos 中查找文件、目录、内容

    1.查找文件 find / -name 'filename'12.查找目录 find / -name 'path' -type d13.查找内容 find . | xargs grep -ri 'co ...

  9. 解决Wamp各版本中 Apache 文件列表图标无法显示

    Edit the following file manually and change the path to the icons folder (it appears times in the fi ...

随机推荐

  1. AngularJS:表单

    ylbtech-AngularJS:表单 1.返回顶部 1. AngularJS 表单 AngularJS 表单是输入控件的集合. HTML 控件 以下 HTML input 元素被称为 HTML 控 ...

  2. 数据库:ubantu下MySQL安装指南

    http://wiki.ubuntu.org.cn/MySQL%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97 安装MySQL sudo apt-get install mys ...

  3. c语言-构建一个静态二叉树

    第一.树的构建 定义树结构 struct BTNode { char data; struct BTNode* pLChild; struct BTNode* pRChild; }; 静态方式创建一个 ...

  4. centos7的xfs配置

    XFS是扩展性高.高性能的文件系统.也是rhel7/centos7的默认文件系统.XFS支持metadata journaling,这使其能从crash中更快速的恢复.它也支持在挂载和活动的状态下进行 ...

  5. jQuery选择器大全整理

    一.选择网页元素 $(document) //选择整个文档对象 $('#myId') //选择ID为myId的网页元素 $('div.myClass') // 选择class为myClass的div元 ...

  6. 解决iText+freemark导出pdf不支持base64的解决办法

    工具类: package test; import java.io.IOException ; import org.w3c.dom.Element ; import org.xhtmlrendere ...

  7. 洛谷P2146 树链剖分

    题意 思路:直接树链剖分,用线段树维护即可,算是树剖的经典题目吧. 代码: #include <bits/stdc++.h> #define ls(x) (x << 1) #d ...

  8. 使用绘图API自定义组件

    -----------------siwuxie095                                 工程名:CustomizeSwing 包名:com.siwuxie095.swi ...

  9. rest-framework组件 之 解析器

    解析器 request类 django的request类和rest-framework的request类的源码解析 局部视图 from rest_framework.parsers import JS ...

  10. Servlet HTTP 状态码 以及 获得浏览器URL

    Servlet HTTP 状态码 HTTP 请求和 HTTP 响应消息的格式是类似的,结构如下: 初始状态行 + 回车换行符(回车+换行) 零个或多个标题行+回车换行符 一个空白行,即回车换行符 一个 ...