wordpress永久链接不适用于aws serever

时间:2015-12-10 06:41:01

标签: php wordpress .htaccess

我正在开发wordpress项目。但永久链接不起作用。如果我将它们设置为默认值它可以工作,但是当我将它设置为发布名称时,它会转到404错误。

我的htaccess文件是:

# BEGIN W3TC CDN
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
# END W3TC CDN
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
    </IfModule>
</IfModule>
# END W3TC Browser Cache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

” 帮我解决wordpress的问题。

由于

1 个答案:

答案 0 :(得分:0)

我刚刚设法解决了这个错误。此处的文档包含了在Word上使wordpress工作正确所需的所有更改的清单 - 包括获取权限更正:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html

你需要为固定链接修复的位是tp 更新httpd.conf文件

(1)位置:/etc/httpd/conf/httpd.conf

(2)找到以 <Directory "/var/www/html">

开头的部分
<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 None

#
# Controls who can get stuff from this server.
#
Require all granted

更改上一节中的 AllowOverride无行,以阅读 AllowOverride All

注意 此文件中有多个AllowOverride行;请务必更改部分中的行。

AllowOverride All

(3)重启Apache服务