An error occurred while connecting to the REST API
-
With “Converter for Media Pro” I tried to start the Bulk Opimization. Then I received the error message below:
Additional information about the process:
11:06:30 – An error occurred while connecting to the REST API. Please, try again.404 – (https://hsolar.energy/en/wp-json/webp-converter/v1/paths)
I found this existing ticket:
REST API endpoint /webp-converter/v1/paths/ returns 404 | ww.wp.xz.cn
It tells: “Please check the rules in your .htaccess file.”
Please be more specific on that. Can I send to you my .htaccess file?The page I need help with: [log in to see the link]
-
Hi @hueck00u,
Thank you for your message.
What’s the correct address for your website’s REST API? You don’t need to provide the full domain, just the path from the URL.
Best,
MateuszHi Mateusz,
The plugin WPML gave an error message that it cannot find REST API. So, I deactivated
“Converter for Media Pro” and replaced the now empty file .htaccess by the initial .htaccess file. After this, WPML was happy concerning REST API. So, now it should be the standard DOMAIN/wp-json.
Kind regards, Ulrich-
This reply was modified 4 months, 1 week ago by
hueck00u.
@hueck00u, is the error visible in the plugin now gone?
I went to “Settings” => “Permalinks” and “Save Changes” without changing anything. Then emptied the cache and re-activated the plugin “Converter for Media Pro”. Now it’s working (conversion ongoing) – and WPML also does not complain about REST API. So, it looks like the problem is solved via the refreshment of permalinks.
What I didn’t like is making .htaccess empty on deactivating “Converter for Media Pro” without bringing .htaccess.bk back into usage as .htaccess@hueck00u, our plugin doesn’t modify the .htaccess file in the WordPress root directory. The plugin modifies the .htaccess file in the /wp-content and /wp-content/uploads directories.
I am using the plugin “WP Original Media Path” and defined the media path as follows: Domain/files
This caused “Converter for Media Pro” to place its .htaccess file into the following two directories:
Domain (root directory) and Domain/files1.) Can I delete the .htaccess in the root directory and replace it by the original version?
2.) Please adapt “Converter for Media Pro” such that it also works fine with “WP Original Media Path” regarding the .htaccess file in the root directory.Thank you for your answer @hueck00u!
I followed these steps on a clean WordPress installation:
- I installed the “WP Original Media Path” plugin.
- In the “Full URL path to files” field I set the value:
https://my-domain.com/files. - I uploaded some images to the Media Library.
- I installed the “Converter for Media” plugin and converted the files to WebP and AVIF formats.
- Files are available in WebP and AVIF formats. Everything works without any additional configuration (my server is Apache with support for .htaccess files).
- The plugin added rules to the .htaccess file in the WordPress root directory. This mechanism works by not removing any other rules that were in that file. The rules added by the plugin are located between the
# BEGIN Converter for Medialine and the# END Converter for Medialine. - The plugin added rules to the .htaccess file in the
/filesdirectory. This mechanism works by not removing any other rules that were in that file. The rules added by the plugin are located between the# BEGIN Converter for Medialine and the# END Converter for Medialine. - The plugin added rules to the .htaccess file in the
/wp-content/uploads-webpcdirectory. The rules added by the plugin are located between the# BEGIN Converter for Medialine and the# END Converter for Medialine.
I can confirm full compatibility with the WP Original Media Path plugin. I can also confirm that our plugin was unable to remove any of your rules from any .htaccess file. Rules added by the plugin always fall between the
# BEGIN Converter for Medialine and the# END Converter for Medialine.Hi Mateusz,
Thanks for your careful testing!
My .htaccess files look different. If you would tell me your email address, then I could send them to you for your analysis.
Kind regards, Ulrich@hueck00u, what does it mean that it looks different?
Below the only content of .htaccess after installation of “Converter for Media”.
So, nothing of the standard WordPress rows found anymore in .htaccessBEGIN Converter for Media ! — DO NOT EDIT PREVIOUS LINE — !
RewriteEngine On
RewriteOptions Inherit
RewriteCond %{QUERY_STRING} original$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . – [L]
RewriteCond %{HTTP_ACCEPT} image/avif
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond /homepages/2/d174764896/htdocs/hsolar/wp-content/uploads-webpc/$1.jpg.avif -f [OR]
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.avif -f
RewriteRule (.+).jpg$ /wp-content/uploads-webpc/$1.jpg.avif [NC,T=image/avif,L]
RewriteCond %{HTTP_ACCEPT} image/avif
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond /homepages/2/d174764896/htdocs/hsolar/wp-content/uploads-webpc/$1.png.avif -f [OR]
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.avif -f
RewriteRule (.+).png$ /wp-content/uploads-webpc/$1.png.avif [NC,T=image/avif,L]+++many similar rows+++
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f
RewriteRule (.+).jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,L]
+++ ending IfModule and a block related to IfModule#! — DO NOT EDIT NEXT LINE — !
#END Converter for MediaIf they’re not there, they never were. @hueck00u, you can safely delete the file, and after re-saving the plugin settings, the rules will be added again.
So, I placed to original .htaccess into the root directory, then saved the “Converter for Media” options. Now the .htaccess has two sections:
# BEGIN Converter for Media
…
# END Converter for Media
# BEGIN WordPress
…
# END WordPress
Thanks. You can close the issue. -
This reply was modified 4 months, 1 week ago by
You must be logged in to reply to this topic.