wp-admin/admin-ajax.php 404 when adding media to article - wordpress

I'm struggling with this problem since a couple of days, I tried everything I found around but nothing seems to fix the problem.
So, I created this wordpress website on my local machine and deployed it on a test server, untill there no problem, everything works as expected. Then I deployed the website to the prod server and everything works fine except that when I try to add an image to an article, the image isn't displayed and I get a 404 error on /wp-admin/admin-ajax.php.
Unfortunately, the prod server is one of those crappy web hosting with cpanel that doesn't give you access to php error logs.
Does someone know how to fix this problem?
Thank you in advance.

Delete .htaccess
Login to your admin panel. Go to:
Dashboard -> Settings -> Permalinks -> Save. (just automatically recreates your .htaccess again). That should do the trick.
If the problem persists. Try disabling plugins. Enable plugins 1 by 1 until the problem occurs again. That will narrow down the faulty plugin.

It was ModSecurity for me as well
If you don't want to disable the ModSec module entirely, you can whitelist rules for certain pages/actions using the ConfigServer ModSec Control module.
In this case I have added a New DirectoryMatch rule for
/wp-admin/admin-ajax.php
The rules I have whitelisted are
941160
949110
980130
You can tell what rules you need to whitelist by using ModSecurity Tools and looking at recent hits and the corresponding Rule ID

I was getting the admin-ajax 404 due to the ModSecurity.
Try to disable the mod security: Cpanel > Security > ModSecurity.

I finally found the problem!
Apparently, the mod_security module of apache was blocking the page. I disabled it and everything works correctly now.

Related

One page won't show on wordpress after moving from live to localhost

I moved my website from live to localhost to make some modifications to it and I have encountered a problem, one page will not show up: "Oops! That page can’t be found.".
I have tried the following
1. activated rewrite_module
2. deactivated each plugin to see if anyone is causing the problem
3. recopied the database and files in case of failure during the first transfer
4. read that resetting permalinks might solve the problem. Changed permalinks to default - the page now works, but when I changed back to custom the problem is still there.
This is weird because only one page does not seem to show, every other page works fine and also there is no problem on the live version.
I ran out of solutions can any one please help?
This may be caused by the permalink or .htaccess
check the url of your page if no issues on URL then
Follow this steps once:
Go to settings-> permalink-> set it as default ->Reload or refresh
Then again now Go to settings-> permalink->postname
Your .htaccess will get update with the permalink.
This could be a problem with htaccess. When using the query string urls in wordpress, no htaccess is required, but for anything else Wordpress uses mod_rewrite.
Is htaccess turned on your localhost Apache server? In httpd.conf, AllowOverride All should be turned on in your active directory.
Is Wordpress able to create new files? Insufficient permissions might prevent it from creating the htaccess file.
Finally, check that your links are pointing to the right place. Sometimes the problem is as simple as a misspelling in your link ;) Good luck.

403 error after adding product to cart

I am creating e-commerce site using woocommerce plugin. Everything works well until adding a product to cart on my site. Then, if I go to the cart page - everything breaks down. Only thing that shows up is
Error occurred: 403 - forbidden
Apache Server at: s1062803-15589.home-whs.pl
Now I have no access to the site at all, even to wp-admin site. What can I do?
Solution - it looks like the problem comes from a .htaccess file on a server. It was blocking some parts of the site. I contacted my hosting operator and they configured the file. Now my site works very well.
sometimes firewall and something like mod_security make this problem. if you are host administrator try to disable them.

apache responding 403 to wordpress tinyMCE js requests

there is something strange happening on my server. It has worked like a charm with wordpress from 2.3 version, and I update it regularly.
Today I updated to wordpress 4.1 and, when I tried to write a post, I found the tinyMCE editor completely unloaded.
I then checked the console and I have a bunch of 403 errors, for requests like
http://www.ilparticolarenascosto.it/wp-content/plugins/jetpack/modules/after-the-deadline/tinymce/plugin.js?v=20140527&wp-mce-4107-20141130
infact my hosting answers with a courtesy page (that doesn't even explain what's happening).
the strange thing is that if i try
http://www.ilparticolarenascosto.it/wp-content/plugins/jetpack/modules/after-the-deadline/tinymce/plugin.js
(without the ending ?v=20140527&wp-mce-4107-20141130 ! ) I can download the file regoularly.
What's happening? what can I do?
I have already reinstalled it, and the problem occours with firefox and chrome, so I think it's a server issue.
And, also, if the first link works to you, maybe it's not working because I'm behind a proxy? but,again, why?
Yes, The first link works for me. I am not sure why it is not working for you.
Clear your browser cache to rule out your browser as a cause
Check you webserver access logs. Access logs will have a response status for every request. It may be possible that some one is overwriting the 200 OK sent by apache
I had the same problem.
It was a security setting on the server, blocking urls with variables.
Wordpress inludes tinymce files with variable in the end:
wp-includes/js/tinymce/themes/modern/theme.min.js?wp-mce-4203-20150730
call your hoster to fix it
it seems that the problem is ... Adblock.
Disable it, clean the browser cache, and reload the page. The Wordpress Editor will suddently appear.

Post redirect to 404 page from admin side in wordpress

I faced a strange issue in my blog. when i publish new articles from admin almost 75% of time it redirect to www.maydomain.com/wp-admin/post.php (Page not found) and nothing saving on the DB.I checked the wordpress forum for this issue they mentioned few things like
1) Disable all the plugins
2) Adding htaccess section
# BEGIN 404 Fix
<IfModule mod_env.c>
#SetEnv MODSEC_ENABLE Off
#PassEnv MODSEC_ENABLE
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
#END 404 Fix
3) Increase the memory limits and maximum size on wp-setting.php
All this i have done but the problem remains. Another strange thing i found is this will happen only on server my localhost xampp its working fine.On server sometime its works fine wordpress version is 3.5.2 and plugin are used only recaptcha and seo yoast
I am using meetgaverwp frame work and theme is there any fix for this problem ?
The whole day i stuck with this ! :(
Now that you did the fix, you probably need to login using a different browser. Redirects are cached for a while.
If your new browser works, clear the cache in your main browser and try again.
Finally I solved this issue.
The issue with old post update or adding new.
First of all I figure out why its happen .The post contain some php variables like session_start() , $_SERVER[] etc is blocked by server.
In some host it will works by disabling mod_security in htacces file.
But on shared host its not works that is why its happen to my blog.
The Solution is Just ask for Hosting Provider and ask to fix with disabling mod_security for your account. The issue fixed Works like charm .. :)

simple press permalink 404 error

I'm trying to use the Simple:Press forum plugin for WordPress. If i go into my sites Settings/Permalinks and select anything other than Default, I get a 404 error whenever I try to access any of the forums or user profile.
Does anyone have a workaround for this?
Edit: I should add this is on a Windows machine and I have added the Web.config file which seems to work fine for other pages
Is the proper .htaccess file being created when permalinks are enabled? Could be a directory not writable issue.
Depending on which version of Wordpress you have, this might be the fix. It's a mod rewrite error.
Right click on the Bookmarklet, and change
u=’+e(l.href)+’
to
u=’+e(l.href.replace(///g,’\/’))+’
A quick work around is to delete part of the URL in the pop. Delete after
http%3A%2F%2F
after the u=, up through the beginning of the domain for the website.

Resources