Woocommerce REST API 404 error - wordpress

Since woocommerce released the 2.1 version with REST API feature, I tried to use it: I activated the API on my woocommerce admin panel but when I try to call the curl: http://www.mydomain.com/wc-api/v1/
the response is a 404 file not found error.
I tried to check everything in internet, I've read woocommerce docs but I cannot figure out what I have to do: probably some setting in the server apache or php... I don't know..
Thank you

Try going, on the Admin Panel, to Settings -> Permalinks. On Default Settings radio group, select the "Post name" one. Save the changes.
Worked for me; hope for you too. :)
Source: this blog post.
EDIT: Website is not available, so I put its Wayback Machine URL.

I was having this same issue. I had forgotten to turn on the pretty perma links, but doing that didn't solve it for me.
I also had to update my apache virtual host file because the AllowOverride was defaulted to None.
<Directory /var/www/wordpress/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Once I updated this, and reloaded the Apache service, the API worked for me.

It was simply a matter of enabling URL rewriting in WordPress. Basically, go to Settings -> Permalinks and make sure the first rewriting option is set to Posts Name.

Apart from answer shared above: Settings -> Permalinks. On Default Settings radio group, select the "Post name" one. Save the changes.
I also had to manually update .htaccess file to reflect the changes I made (permalinks to "Post name", and the little Wordpress help text shown on the bottom of the page was really helpful:
If your .htaccess file was writable, we could do this automatically,
but it isn’t so these are the mod_rewrite rules you should have in
your .htaccess file. Click in the field and press CTRL + a to select
all.
Basically copy the new mod_rewrite rules as instructed by Wordpress above and manually update your .htaccess file! doing this worked for me!

Related

Updating failed Post in Wordpress

I am working on WordPress blog and just started to post a new post its giving error me "Updating failed". I am not able to edit the sample post and also not able to post a new article.
WordPress Version: 5.0.2
Any Idea to resolve this issue?
Thanks
Browser Inspector View
This problem is caused by the Gutenberg editor.
If you're website is hosted by any hosting provider, use the classic editor.
If you're hosting your website on a VPS, and you're running on Apache, try adding
<Directory /path/to/your/website>
AllowOverride All
</Directory>
To your virtual host.
If you want to get rid of this issue, you have to change the permalink structure from the admin side.
Please read this article Solution link
I saw the same problem occur when I would select certain Permalink settings (specifically ones that caused the site's .htaccess to contain anything other than a blank file).
The issue ended up being: I did not have mod-rewrite enabled on my server.
The fix: I uncommented the below (in httpd.conf) and the problem went away (and it stayed fixed no matter what Permalink settings I select in WordPress) (be sure to restart Apache after httpd.conf edits)
LoadModule rewrite_module modules/mod_rewrite.so
WordPress permalinks error for "pretty permalinks" on a Google Cloud instance gives 404 error on all the pages even if created using the default permalink, reverting it back to "pretty permalinks".
I like "pretty permalinks" and found out the best solution for the above situation is to
Enable mod_rewrite in Apache:
Then, goto
Compute Engine>VM Instances > SSH
Type $: a2enmod rewrite
Type $: sudo nano /etc/apache2/apache2.conf
then Change: AllowOverride ALL from AllowOverride NONE
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride ALL
Require all granted
</Directory>
Restart Apache Server:
sudo service apache2 restart
It should now update, create posts/pages in "pretty permalinks" with default Gutenberg editor without giving 404 error.
Solves the Rest API error
https://www.praj.info
My site was behind Cloudflare and this seemed to be the reason for this issue.
In order to fix it I just installed cloudflare plugin for wordpress.
This error occurs when you are working on the Gutenberg editor. You can use the classic editor to overcome this problem.
Go to the plugins>add new
Search for a classic editor plugin and install it.
If this doesn't work deactivate all plugins.
After, you disabled all plugins start enabling plugins one by one to see which one will break WordPress again.
Or you can see this article:- fix WordPress updating failed while creating or publishing a post.
Check the url in the wordpress setting, you probaly set website url as "http". It'll be fixed.

WordPress Permalinks Issue

So we installed a fresh version of WP. Thanks for the help earlier.
The last issue we cannot figure out is why we cannot navigate the site.
Basically, when we try to navigate internally into the website we imported into the sandbox, it gives the following:
The requested URL /page-name/ was not found on this server.
If it's the ugly / default Permalink, we can view the files under pages, but we cannot navigate even. The pages were set to /page-name/, which I'm pretty sure is /%postname%/. I've scoured online. I've put up a blank .htaccess file, changed the permissions to 666 for writing purposes.
What I've tried included:
Replacing the .htaccess with a blank (I renamed the old one to be a backup) - it generates information to the file.
We can view pages manually that way, but we cannot navigate through the "live" site with it running this way.
Is there a second source I should be referring to for updates on the .htaccess file? Is there tricks online I may have overlooked? Any input would be appreciated!
Thank you!
Thank you Milap for the comment above! It turned out to be the AllowOverride being false. Apparently this have to be enabled in order for it to work. To those who plan to make this change, restarting your server is required.
Please refer to section AllowOverride Not Enabled section of their documentation: https://codex.wordpress.org/Using_Permalinks

WordPermalink not working after server tran

I've transferred our website http://www.pacificluxuryliving.com from powweb to godaddy. It's a wordpress based website.
The problem is the pretty permalink is not working. It shows 404 error. Interestingly, If I add new post or new page, the permalink work. But all old permalinks not working. I can edit old pages and change the permalink (from edit page). If I change the old permalink to new one, then it also work.
I disabled pretty permalink + deleted .htaccess file. Then enabled pretty permalink from wp admin > settings > permalinks (it automatically restored .htaccess);
Tried many other ways, but nothing worked.
Thanks,
Farhad
Check the following
Do you have mod_rewrite enabled?
Do you have any caching Plugins? If yes then disable them.
Is FollowSymLinks option enabled?
Also post the contents of your .htaccess file and the pretty permalink format that you want to use.

Wordpress permalinks problem

I changed my wordpress permalinks to %pagname%. Prior to doing this i posted two blog entries (the site is brand new). My static pages navigate fine after the changes but when you click on my posts you get 404'd. Has anyone else had this problem? Thanks.
isn't the permalink structure supposed to be
/%postname%/
with that the posts will have a nice url, and not using pagename, or pagname as you have it?
Open your .htaccess file and check if anything is written, if so highlight it all and delete it, wordpress will fall back to the original default state,
then within the admin->settings->permalink section select custom and paste in that, and click save, if wordpress reloads the page and the htaccess info is pinned to the bottom of the page then copy and paste that to your .htaccess file, if its not then its been written to your file already...
You probably fixed it by now, but try adding "/%postname%/" after "/%pagename%/. I was having the same problem but changed mine to read /%pagename%/%postname%/ and it seems to work now.
check .htaccess file permission has 777
I did like that and works.
Reset your permalinks and make sure .htaccess is writable: Using Permalinks « WordPress Codex
Check your apache configuration and verify that for the directory in which you store your Wordpress installation you have following settings enabled (probably there will be more, but you need at least these):
<Directory var/www/>
FollowSymLinks
AllowOverride All
</Directory>

Need help changing Permalinks in Wordpress, I've tried everything

I am having problems getting my Permalinks changed with my Wordpress instance. I have about 5 blog posts which were created using the default "postid" permalinks. I am now trying to change my permalink to %postname% but I cannot get it to work. Any time I change the Permalinks in Wordpress all my old posts throw 404s. I have tried 4 Wordpress Permalink plugins to resolve this issue but I cannot get any of them to work. I have also updated my blog's .htaccess file to include the necessary information. Finally I deleted all my original posts and changed the Permalink, then recreated them and it still did not work. Please help, I don't know what else to try! Thanks
Be sure there is only one wordpress rewrite block in .htaccess. And you may need to go into the wp_options table in the database with phpmyadmin and clear the permalink setting there. Once in a while permalink settings get "stuck" in the wp_options table and wordpress can't write the new setting to the database, even though WP writes the changes to the .htaccess file. Database Description « WordPress Codex
Edit 3/03/10
Turned out to be mostly CentOS not playing nice with Wordpress Permalinks, but there are documented fixes via Google.
Edit 3/02/10
If your .htaccess is writable and changes are being saved and you can see them, then permalink_structure field in wp_options should not be blank. Did you disable and delete all plugins relating to permalinks and start from scratch? Are you on Windows or Linux hosting?
I had the exact same issue, and it's subtle. The apache directives need to go in a <Directory> container. If you are like me, you had your directive in a <Location> container, thinking that <Location /> would cover the entire site from the root, recursively.
This did the trick:
<Directory /path/to/wordpress>
AllowOverride All
Options FollowSymLinks
</Directory>
Use deans permalink migration plugin and you will easily change your permalink structure without breaking any links within a minute. This plugin is a life saver for those who are thinking of changing default permalink structure and thinking of migrating from blogspot blog to self-hosted blog.
I know this is an old thread but I ran into this issue last night. I found a post here http://www.mobiledataup.com/fix-wordpress-permalink-404-error-with-centos-6/
which was very help and fixed the probem for me.
There was an extra section that had options to turn on AllowOverride.
Worked like a charm.
Reading this article will help a lot with permissions and PHP handlers. I had some of the problems here... just thought I'd share it
http://www.itsabhik.com/how-to-increase-size-of-var-tmp-centos/

Resources