Apache Typecho框架启用地址重写
Posted lyshark
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Apache Typecho框架启用地址重写相关的知识,希望对你有一定的参考价值。
地址重写有利于SEO优化,开启地址重写可以去掉Typecho框架中的index.php后缀,该后缀如下。
第一步,进到apache配置文件目录下cat /etc/httpd/conf/httpd.conf
加入以下模块。
LoadModule rewrite_module modules/mod_rewrite.so
第二步,配置空间权限,将AllowOverride None
改为AllowOverride All
# Further relax access to the default document root:
#
# 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"
# doesnt 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
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
第三步,在网站根目录新建vim /var/www/html/.htaccess
写入重写规则。
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule . /index.php [L]
第四步,启用地址重写。
再次访问即可完成。
版权声明:本博客文章与代码均为学习时整理的笔记,文章 [均为原创] 作品,转载请 [添加出处] ,您添加出处是我创作的动力!
以上是关于Apache Typecho框架启用地址重写的主要内容,如果未能解决你的问题,请参考以下文章
apache_conf 必须启用postname permalinksApache重写模块的基本.htaccess文件 - 主要用于YeoPress