admin管理员组文章数量:1304517
There is a chance this has been answered elsewhere - I have searched as thoroughly as I can here and elsewhere.
I have the following errors on my site, wonkylogic.co, (hosted on LAMP server on Digital Ocean, I followed their tutorials):
- Could not create directory for theme installation. I manually created the directory over ssh to fix this; but may still be relevant to my other errors.
- When updating a page: “Publishing failed. The response is not a valid JSON response.” I’ve found various “solutions” to this: editing .htaccess multiple ways, editing Apache config, editing urls in mysql database. Tried them all and they didn’t fix anything. Change permalinks to plain or /index.php/<post_name>. Changing permalinks works - I can update pages. But obviously this isn’t a real solution because now I have SEO unfriendly urls and all external links to my site are broken.
- Navigation to webpages generates a 404 error. This is fixed by changing the permalinks as in 2. above. Again not an ideal fix.
So the overarching questions are “Why is my site broken this way?” and “How do I fix the root problem?”
Additional context: I migrated my site from shared hosting to Digital Ocean using WP-migrate plugin. It appeared to work for a while, got totally broken after installing SSL with Let’s encrypt. I’ve basically rebuilt the LAMP stack and after much blood sweat and tears got my site vaguely visible as it is now (http only right now - one step at a time).
As an interim measure I will set up some custom redirects to the new urls for external visitors using a plug-in I’ve found.
Update: it seems that my website may not even be accessible, I'm not sure why but I can access it via Safari, but not with Chrome or Firefox.
Seeing what's in .htaccess was requested.
==================== .htaccess ====================
#Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPres>
# dynamically generated, and should only be modified via WordPress f>
# Any changes to the directives between these markers will be overwr>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
================== END .htaccess ==================
There is a chance this has been answered elsewhere - I have searched as thoroughly as I can here and elsewhere.
I have the following errors on my site, wonkylogic.co, (hosted on LAMP server on Digital Ocean, I followed their tutorials):
- Could not create directory for theme installation. I manually created the directory over ssh to fix this; but may still be relevant to my other errors.
- When updating a page: “Publishing failed. The response is not a valid JSON response.” I’ve found various “solutions” to this: editing .htaccess multiple ways, editing Apache config, editing urls in mysql database. Tried them all and they didn’t fix anything. Change permalinks to plain or /index.php/<post_name>. Changing permalinks works - I can update pages. But obviously this isn’t a real solution because now I have SEO unfriendly urls and all external links to my site are broken.
- Navigation to webpages generates a 404 error. This is fixed by changing the permalinks as in 2. above. Again not an ideal fix.
So the overarching questions are “Why is my site broken this way?” and “How do I fix the root problem?”
Additional context: I migrated my site from shared hosting to Digital Ocean using WP-migrate plugin. It appeared to work for a while, got totally broken after installing SSL with Let’s encrypt. I’ve basically rebuilt the LAMP stack and after much blood sweat and tears got my site vaguely visible as it is now (http only right now - one step at a time).
As an interim measure I will set up some custom redirects to the new urls for external visitors using a plug-in I’ve found.
Update: it seems that my website may not even be accessible, I'm not sure why but I can access it via Safari, but not with Chrome or Firefox.
Seeing what's in .htaccess was requested.
==================== .htaccess ====================
#Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPres>
# dynamically generated, and should only be modified via WordPress f>
# Any changes to the directives between these markers will be overwr>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
================== END .htaccess ==================
Share
Improve this question
edited Jan 26, 2021 at 12:58
Dan
asked Jan 23, 2021 at 12:27
DanDan
113 bronze badges
10
|
Show 5 more comments
1 Answer
Reset to default 0I have finally figured out the root cause of why I was getting the invalid JSON response and why permalinks had to be set to include index.php in all urls. My Apache configuration file was not allowing overrides and I think that means Wordpress was unable to alter files in my directory. The setting for my directory was:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
This was changed to:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Errors no longer plaguing my site. Thank you to everyone who took the time to respond.
本文标签: Error updating pagesand linking to pages (permalink error)
版权声明:本文标题:Error updating pages, and linking to pages (permalink error) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741788761a2397537.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
WP_DEBUG
&WP_DEBUG_LOG
enabled, these errors should also be recorded in the log. But the dev tools Network tab records HTTP requests which the web page is making. If you have the tab open and recording when you attempt to publish a post, you'll see a new request made, probably to something likeindex.php?rest_route=
- if you select that request, and then the "Response" tab of the inspector panel for that request, you will be able to directly inspect the server's response. And there you will likely find that some extraneous output has messed up the JSON – bosco Commented Jan 23, 2021 at 18:14