Rootop 服务器运维与web架构

Linux环境下配置apache支持WordPress伪静态

| 暂无评论

修改 httpd.conf 配置文件(红色部分):

# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the “default” to be a very restrictive set of
# features.
#
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled – so if something’s not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<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.2/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

LoadModule rewrite_module modules/mod_rewrite.so

然后在wordpress主目录下建立.htaccess 权限设置为777便于 永久链接设置 伪静态规则能写入.htaccess文件

然后在后台管理中,找到设置-永久链接,有几项可以自己选。

自定义的话可以这样:/pages/%post_id%/.html  根据提交的文章id生成静态页。便于收录。

 

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/910.html

作者:Venus

服务器运维与性能优化

发表回复