地址重写有利于SEO优化,开启地址重写可以去掉Typecho框架中的index.php后缀,该后缀如下。

第一步,进到apache配置文件目录下cat /etc/httpd/conf/httpd.conf 加入以下模块。

  1. LoadModule rewrite_module modules/mod_rewrite.so

第二步,配置空间权限,将AllowOverride None改为AllowOverride All

  1. # Further relax access to the default document root:
  2. <Directory "/var/www/html">
  3. #
  4. # Possible values for the Options directive are "None", "All",
  5. # or any combination of:
  6. # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  7. #
  8. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  9. # doesn't give it to you.
  10. #
  11. # The Options directive is both complicated and important. Please see
  12. # http://httpd.apache.org/docs/2.4/mod/core.html#options
  13. # for more information.
  14. #
  15. Options Indexes FollowSymLinks
  16. #
  17. # AllowOverride controls what directives may be placed in .htaccess files.
  18. # It can be "All", "None", or any combination of the keywords:
  19. # Options FileInfo AuthConfig Limit
  20. #
  21. AllowOverride All
  22. #
  23. # Controls who can get stuff from this server.
  24. #
  25. Require all granted
  26. </Directory>

第三步,在网站根目录新建vim /var/www/html/.htaccess写入重写规则。

  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteRule ^index\.php$ - [L]
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteRule . /index.php [L]

第四步,启用地址重写。

再次访问即可完成。

Apache Typecho框架启用地址重写的更多相关文章

  1. Farseer.net轻量级开源框架 中级篇:UrlRewriter 地址重写

    导航 目   录:Farseer.net轻量级开源框架 目录 上一篇:Farseer.net轻量级开源框架 中级篇: Cookies.Session.Request 下一篇:Farseer.net轻量 ...

  2. 解决URL中包含“%2F”导致Apache地址重写mod_rewrite失效的问题

    在使用Apache地址重写mod_rewrite期间,发现,当URL和PATH_INFO中出现%2f(/)或者%5c(\), 会被认为这是个不合法的请求, Apache将会直接返回"404 ...

  3. 项目搭建系列之四:SpringMVC框架下使用UrlRewrite实现地址重写

    简单记录一下UrlRewrite实现地址重写功能. 1.pom.xml 在pom.xml增加配置UrlRewrite jar <!-- URL Rewrite --> <depend ...

  4. php url地址重写

    地址重写: urlRewrite: 就是:  1. 将php的地址index.php不写只写Action模块和function方法, 或者 2. php地址转变成html地址, 就是一种假的html, ...

  5. Nginx_地址重写(rewrite)_日志管理(log_format)_压缩输出_Nginx设定限速_Nginx设置反向代理及反向代理缓存

    Nginx地址重写 Nginx rewrite rewrite语法规则1).变量名可以使用 "=" 或 "!=" 运算符~ 区分大小写~* 不区分大小写^~ 禁 ...

  6. Apache 流框架 Flink,Spark Streaming,Storm对比分析(一)

    本文由  网易云发布. 1.Flink架构及特性分析 Flink是个相当早的项目,开始于2008年,但只在最近才得到注意.Flink是原生的流处理系统,提供high level的API.Flink也提 ...

  7. Web Service与Apache CXF 框架

    一.WebService简介 为了支持跨网络的机器间相互操作交互而设计,用于开发分布式的互操作的应用程序组件. Web Service服务通常被定义为一组模块化的API,它们可以通过网络进行调用,来执 ...

  8. 高级运维(三):部署Lnmp环境、构建Lnmp平台、地址重写

    一.部署LNMP环境 目标: 安装部署Nginx.MariaDB.PHP环境 1> 安装部署Nginx.MariaDB.PHP.PHP-FPM: 2> 启动Nginx.MariaDB.FP ...

  9. Apache—DBUtils框架简介

    转载自:http://blog.csdn.net/fengdongkun/article/details/8236216 Apache—DBUtils框架简介.DbUtils类.QueryRunner ...

  10. JDBC 学习笔记(四)—— 自定义JDBC框架+Apache—DBUtils框架+事务管理+操作多表

    本文目录:       1.自定义JDBC框架 ——数据库元数据:DataBaseMetaData        2.自定义JDBC框架 ——数据库元数据:DataBaseMetaData       ...

随机推荐

  1. Go--Println、Printf区别

    Println:打印字符串.变量:    同函数输出多项,之间存在空格    不同函数输出自动换行 Printf:打印需要格式化的字符串,可以输出字符串类型的变量:不可以输出整型变量和整型   同函数 ...

  2. [译]为什么你应该关注 Docker

    注:该文原文为 Why You Should Care About Docker ,由 CHRIS DAWSON 编写. 当我在 Dockercon 上陶醉于那些令人激动地议题时,我想到了一个问题:我 ...

  3. AtCoder Beginner Contest 179 个人题解(C欧拉筛,D前缀和,E循环节,F线段树)

    补题链接:Here A - Plural Form 字符串,末尾有 s 的加es,不然加 s . B - Go to Jail 输入的时候判断一下是否连续相等即可 C - A x B + C (mat ...

  4. springboot+vue实现 下载服务端返回的文件功能

    开发中会遇到,通过浏览器下载服务器端返回的文件功能,本文使用springboot+vue实现该功能. 后端代码: 注:后端返回的文件名遇到中文就会乱码,一直也没得到很好的解决方案,最后就统一返回1.x ...

  5. C#树的实现

    ddd /// <summary> /// 遍历,线索化等操作的接口 /// </summary> interface ITravelBinTree { void PreOrd ...

  6. AHB 设计要点

    Hreadyout 每个slave回复hreadyout通过mux给到master master会将hreadyin信号给到每个slave hreadyout开始的时候都为1,如果是为0,会出现问题, ...

  7. MyBatis03——ResultMap和分页相关

    ResultMap和分页相关 当属性名和字段名不一致的时候 解决方法 1.数据库中创建user表 字段 id.name.pwd 2.Java中的实体类 @Data public class User ...

  8. [转帖]Nginx Ingress 高并发实践

    概述 Nginx Ingress Controller 基于 Nginx 实现了 Kubernetes Ingress API,Nginx 是公认的高性能网关,但如果不对其进行一些参数调优,就不能充分 ...

  9. [转帖]Arm vs X86 (unfinished)

    http://home.ustc.edu.cn/~shaojiemike/posts/arm/   ARM Ltd history 诞生 1981年,被Intel拒绝的Acorn(橡子) Comput ...

  10. [转帖]APIServer dry-run and kubectl diff

    https://kubernetes.io/blog/2019/01/14/apiserver-dry-run-and-kubectl-diff/ Monday, January 14, 2019 A ...