Apache Typecho框架启用地址重写
2023-02-18 16:46:16 时间
地址重写有利于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:
<Directory "/var/www/html">
#
# 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
</Directory>
第三步,在网站根目录新建vim /var/www/html/.htaccess
写入重写规则。
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
第四步,启用地址重写。
再次访问即可完成。
相关文章
- 行业趋势|光伏行业SCM供应链数字化管理优势、价值
- 破除上下游梗阻,如何为能源化工行业开出“新良方”?
- 软件分享 | 第一期 Markdown神器Typora安装和破解教程
- jira-dev-tool插件安装失败的解决方法
- 软件分享 | 第二期 截图神器snipaste安装和使用教程
- 基于Hexo搭建静态博客
- 软件分享 | 第三期 搜索神器listary安装和使用
- 发送HTML模板邮件
- 使用3-hexo主题时无法正常渲染html代码
- 在Mac下使用zsh
- 作为程序员,应该从哪里出发
- RHEL8重置root用户密码步骤
- 在Hexo中引入本地图片的实现
- 软件分享 | 第五期 去水印神器获取和安装
- WPS部分题库选择题
- 软件分享 | 第六期 服务器远程连接工具获取和安装
- 软件分享 | 第八期 Everything本地文件搜索利器获取
- RDP Wrapper实现多人远程
- 软件分享 | 第九期 强大的录屏工具班迪录屏Bandicam
- 软件分享 | 第十一期 免费的护眼神器f.lux