Php 更改Permalinks格式会导致各种问题
我已经安装了Wordpress,默认的permalink格式是“/index.php/post name”。我想将其更改为“/post name”,因此URL将是“domain.com/blog/”而不是“domain.com/index.php/blog”,但这会导致一些奇怪的问题。我在Stackoverflow上也看到过同样问题的帖子,但没有找到确切的回复 当permalink设置为“/index.php/post name”时,一切似乎都正常工作。当我将其更改为“/post name”时,将开始接收错误 发布失败。错误消息:响应不是有效的JSON 答复 有趣的是,在查看开发人员工具时,当我尝试使用“/index.php/post name”发布页面时,请求被发送到hxxps://domain.com/index.php/wp-json/wp/v2/taxonomies/post_tag?context=edit&_locale=user但当我尝试使用“/post name”时请求被发送到hxxps://domain.com/wp-json/wp/v2/pages/[[POST ID]]?_locale=user返回404 在尝试遵循其他答案的建议后,我的.htaccess如下所示:Php 更改Permalinks格式会导致各种问题,php,wordpress,Php,Wordpress,我已经安装了Wordpress,默认的permalink格式是“/index.php/post name”。我想将其更改为“/post name”,因此URL将是“domain.com/blog/”而不是“domain.com/index.php/blog”,但这会导致一些奇怪的问题。我在Stackoverflow上也看到过同样问题的帖子,但没有找到确切的回复 当permalink设置为“/index.php/post name”时,一切似乎都正常工作。当我将其更改为“/post name”时,
Options +FollowSymlinks
RewriteEngine on
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<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
Options+FollowSymlinks
重新启动发动机
#开始WordPress
#“BEGIN WordPress”和“END WordPress”之间的指令(行)是
#动态生成,只能通过WordPress过滤器修改。
#这些标记之间对指令的任何更改都将被覆盖。
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
事先是:
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<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
#“BEGIN WordPress”和“END WordPress”之间的指令(行)是
#动态生成,只能通过WordPress过滤器修改。
#这些标记之间对指令的任何更改都将被覆盖。
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
执行a2enmod retwrite操作将返回状态“模块重写已启用”。
我已经安装了Classic Editor插件,该插件似乎可以发布,但尝试访问该文件时返回404
我的环境是Ubuntu 16.04.4 LTS。
任何帮助都将不胜感激 发现问题-必须将/etc/apache2/sites available/000 default.conf从AllowOverride None更改为AllowOverride All您使用的是apache还是nginx?我使用的是apache