我正在从HTML模板编写一个主题。最初,我只是删除了索引。带有的php。htaccess组件the answer shows.
现在我甚至在主页上也出现了“内部服务器错误”,这在之前是有效的。
我已经尝试过一千次改变我的永久性链接。不知道该怎么办了。
我想我使用的是最新的WP版本,5.2.2。我被锁在仪表板外面了。但如果有帮助的话,我有wp cli。
谢谢你的帮助!
This is my apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
My .htaccess in /var/www/html/site2.localhost/public_html/
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
SO网友:FabioB
我刚刚找到了答案。
首先,我查看apache错误日志/var/log/apache2
, 关于文件错误。日志1我找到了最后几行:
[Sun May 26 22:46:23.694952 2019] [core:alert] [pid 8436] [client ::1:52840] /var/www/html/site2.localhost/public_html/.htaccess: Invalid command \'RewriteEngine\', perhaps misspelled or defined by a module not included in the server configuration, referer: http://site2.localhost/wp-admin/edit.php?post_type=page
[Mon May 27 00:08:19.614216 2019] [mpm_prefork:notice] [pid 8418] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server\'s fully qualified domain name, using 127.0.1.1. Set the \'ServerName\' directive globally to suppress this message
搜索“无效命令‘RewriteEngine’”,我发现
this thread 有一个
answer to the question:查找文件重写。加载到/etc/apache2/mods-enabled
, 如果未找到文件,请运行sudo a2enmod rewrite
重新启动apache后sudo service apache2 restart
.
现在文件重写。加载显示在/etc/apache2/mods-enabled
目录和我只是刷新浏览器,使一切恢复正常。