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. Http工作过程

    一次HTTP操作称为一个事务,其工作整个过程如下: 1 ) .地址解析, 如用客户端浏览器请求这个页面:http://localhost.com:8080/index.htm 从中分解出协议名.主机名 ...

  2. postgresql 主从复制并切换

    1 环境 192.168.19.145 Kylin 3.3 mysqlhq  9.5.2  psql_master192.168.19.227 Kylin 3.3 mysql3    9.5.2  p ...

  3. c# 遍历目录

    public static List<string> TraverseDirector(string dir, bool isTraveSubDirFlag, bool isFilterS ...

  4. Vue指令学习

    # new Vue({ vue所有的数据都是放到data里面的 # data:{ vue对象的数据 # a:1,对象 # b:[] , # } # methods:{vue对象的方法 # dosomt ...

  5. javascipt——基础知识——基本数据类型和逻辑运算

    进制转换:http://www.topthink.com/topic/504.html javascript的数据类型分为基本数据类型和非基本数据类型(对象) 一.基本数据类型: 包括以下部分:数字. ...

  6. 11-15SQLserver基础--数据库之范式理论

    数据库的设计理论与思路 在设计数据库的时候,有一个著名的设计理论---范式理论. 1.内容: 第一范式:每一列的数据类型要单一,必须要统一: 第二范式:在设计主键的时候,主键尽量更能体现表中的数据信息 ...

  7. 【Android 多媒体应用】使用 VideoView 播放视频

    1.MainActivity.java import android.os.Bundle; import android.support.v7.app.AppCompatActivity; impor ...

  8. sharepoint文档库中日期显示详细日期,不显示几天前

    文档库---库设置----栏

  9. ie6下会拒绝高度小于字号的设置

    <div style="height: 5px;background-color: yellow">wojitianhenkaixin</div> 此时浏览 ...

  10. C# 设置程序session过期时间

    服务器设置: 如果服务器上点击站点没有ASP这一项: 下方 角色服务 添加角色服务 安装完毕重新打开iis 点击站点 就可以看到ASP这个选项了 程序webconfig配置: <system.w ...