0
点赞
收藏
分享

微信扫一扫

Apache Typecho框架启用地址重写

Gascognya 2022-05-30 阅读 88

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

Apache Typecho框架启用地址重写_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"
# doesn't 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框架启用地址重写_ide_02

再次访问即可完成。

版权声明:本博客文章与代码均为学习时整理的笔记,文章 [均为原创] 作品,转载请 [添加出处] ,您添加出处是我创作的动力!


举报

相关推荐

0 条评论