简体   繁体   English

WordPress的永久链接不适用于AWS

[英]Wordpress permalink not working on aws

I have spent 4-5 hours to sort it out but not able to solve it. 我花了4-5个小时来解决问题,但无法解决。

I have setup my wordpress website on AWS.Everything is working file except the permalinks of wordpress. 我已经在AWS上设置了wordpress网站,除了wordpress的永久链接之外,所有东西都在工作。

When permalinks are set to default pages/posts are working but not working with "%post-name%". 当永久链接设置为默认页面/帖子时有效,但不适用于“%post-name%”。

I have tried almost all the things by searching over google but no success. 我已经尝试通过Google搜索几乎所有东西,但没有成功。

I saw so many solutions all related to httpd.conf file but on my root there is no file httpd.conf neither no directory of http. 我看到了很多与httpd.conf文件相关的解决方案,但是在我的根目录上没有httpd.conf文件,也没有http目录。

I changed the following code in apache.conf file but still not working 我在apache.conf文件中更改了以下代码,但仍无法正常工作

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all denied
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Restarted apache again and again but no luck. 一次又一次地重新启动了Apache,但是没有运气。

Please help me guys. 请帮助我。

Thanks. 谢谢。

I've just managed to fix this error. 我已经设法解决了这个错误。 Make sure you restart Apache service after making the httpd.conf change! 确保在更改httpd.conf后重新启动Apache服务!


Documentation here has a checklist of all the changes you need to get wordpress working correclty on AWS - including getting permissions correct: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html 此处的文档列出了使Wordpress在AWS上正常运行所需的所有更改的清单-包括正确获取权限: http ://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html

The bit you need to fix for permalinks is tp update the httpd.conf file 您需要修复的永久链接是tp 更新httpd.conf文件

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

(2) Find the section that starts with <Directory "/var/www/html"> (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

Change the AllowOverride None line in the above section to read AllowOverride All 更改以上部分中的AllowOverride None行以读取AllowOverride All

Note There are multiple AllowOverride lines in this file; 注意:此文件中有多条AllowOverride行。 be sure you change the line in the section. 确保更改该部分中的行。

AllowOverride All

(3) Restart the Apache service (3)重启Apache服务

If you dont have much experience using aws, then i guess its because you have not granted enough permissions to your apache. 如果您没有使用AWS的丰富经验,那么我想是因为您没有为您的Apache授予足够的权限。 If you are unware of how to grant permissions to your apache, you can use this command in your console 如果您不知道如何授予您的apache权限,则可以在控制台中使用此命令

sudo CHOWN -R apache:apache /var/www/html

Once done try going to your settings page and saving the new settings. 完成后,请尝试进入“设置”页面并保存新设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM