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. Java-API:java.math.BigDecimal

    ylbtech-Java-API:java.math.BigDecimal 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部 1. https://docs.ora ...

  2. SpringMVC—对Ajax的处理(含 JSON 类型)(1)

    一.首先要搞明白的一些事情. 1.从客户端来看,需要搞明白: (1)要发送什么样格式的 JSON 数据才能被服务器端的 SpringMVC 很便捷的处理,怎么才能让我们写更少的代码,如何做好 JSON ...

  3. CreateRemoteThread 远程注入

    在release中可以成功,在debug中被注入的程序停止工作 #pragma once#include "stdafx.h"#include <windows.h># ...

  4. python爬虫--常见错误

    1)socket.error: [Errno 10054] ython socket.error: [Errno 10054] 远程主机强迫关闭了一个现有的连接.因为对一个网站大量的使用urlopen ...

  5. css水平居中,竖直居中技巧(一)

    css水平居中,竖直居中技巧(一)===### 1.效果 ### 2.代码#### 2.1.index.html <!DOCTYPE html> <html lang="z ...

  6. Cocos2d-js 热更新学习笔记

    转载至: http://blog.csdn.net/pt_xxj/article/details/68927705 为什么还要再写一篇关于cocos2d js热更新的笔记,最单纯的想法就是记录心得,另 ...

  7. JS的Prototype属性

    转载至: http://blog.sina.com.cn/s/blog_7045cb9e0100rtoh.html 函数:原型 每一个构造函数都有一个属性叫做原型(prototype,下面都不再翻译, ...

  8. cakephp静态资源404

    location ~ /\.(css|js|woff|ttf|gif|jpg|jpeg|png|bmp|swf) { rewrite ^/$/(.*)$ /$/app/webroot/$ last; ...

  9. jquery 的插件 extend

      让我们来讲解  jquery中的插件机制  $.fn.extend and()  $.extend()这两个方法都接受一个参数,类型为Object.Object对象的“名/值对”分别代表“函数或方 ...

  10. 数据结构_yjjsj(伊姐姐数字游戏)

    问题描述 伊姐姐热衷于各类数字游戏, 24 点. 2048.数独等轻轻松松毫无压力.一日,可爱的小姐姐邀请伊姐姐一起玩一种简单的数字 game,游戏规则如下:一开始桌上放着 n 张数字卡片,从左到右按 ...