WordPress的permalink不工作的AWS

jhkqcmku  于 2023-05-28  发布在  WordPress
关注(0)|答案(3)|浏览(182)

我花了4-5个小时来整理它,但无法解决它。
我已经在AWS上设置了我的WordPress网站。除了WordPress的永久链接外,所有内容都是工作文件。
当永久链接被设置为默认页面/帖子工作,但不与“%post-name%”工作。
我已经尝试了几乎所有的东西通过搜索在谷歌,但没有成功。
我看到很多解决方案都与httpd.conf文件有关,但在我的根目录下没有httpd.conf文件,也没有http目录。
我在apache.conf文件中修改了下面的代码,但是仍然不能工作

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

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

一次又一次地重启Apache,但没有成功。
请帮帮我,伙计们。
谢谢。

5lhxktic

5lhxktic1#

我刚刚修复了这个错误。确保在修改httpd.conf后重新启动Apache服务!
这里的文档有一个清单,列出了让WordPress在AWS上正确工作所需的所有更改-包括正确获取权限: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 None行改为AllowOverride All

注意此文件中有多行AllowOverride;请确保更改剖面中的线。

AllowOverride All

(3)重启Apache服务

pokxtpni

pokxtpni2#

如果你没有太多的使用AWS的经验,那么我猜这是因为你没有授予足够的权限给你的Apache。如果您不知道如何向Apache授予权限,可以在控制台中使用此命令

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

完成后,尝试转到设置页面并保存新设置。

gg0vcinb

gg0vcinb3#

需要将FollowSymLinks更改为ALL
请按照以下步骤操作:
步骤1:在终端上运行以下命令

sudo nano /etc/apache2/apache2.conf

2.搜索

Options Indexes FollowSymLinks
AllowOverride None
Require all granted

将“无”更改为“全部”,如下所示:

Options Indexes FollowSymLinks
AllowOverride All
Require all granted

第3步:保存文件按Ctrl+X,然后,按Y,按Enter.
步骤4:使用下面的命令重新启动Apache

sudo service apache2 restart

就是这样谢谢你**
如果问题仍然存在,请尝试以下命令

sudo a2enmod rewrite

然后低于命令

sudo service apache2 restart

相关问题