I have permalinks set to "Post name".
If I put in my address bar: http://www.example.com/section1/whitepapers/, WordPress loads it correctly, but if I send a POST or GET request to the same URL, it throws a 404 error inside WordPress.
This is my htaccess file: https://gist.github.com/3062205
Could someone shed a light on what might be happening here?
NOTE: The 404 error is thrown by WordPress, it's not a Server 404 message.
What parameters do you submit with the GET and POST requests. Wordpress will strip out any parameters with 'name' in it. I my case i renamed a parameter 'firstname' to 'fn' and it worked. See wordpress-404page-not-found-on-form-posted-data
could your url be redirecting from WWW to nonWWW or vice-versa?
Can you see the header response it returns
Related
I have a question.
Does setting a post/page staus to "private" will it generate a true 404 page with 404 header? Or it's just a page showing that is not found?
I want Google to know that the page no longer exists and it's 404.
Settings to private makes the site say it's not found, but how do I know it's a true 404 error?
Thanks! :)
What you are looking for is the HTTP response status of the URL.
You have to look about. Google about something like "get HTTP status of a URL", and you'll find many free tools to check URLs HTTP statuses.
You can also check yourself with your browser console whether it's a real 404 or not.
In the network tab, you'll have the page request lists and HTTP status for each. From there, check the request having your page URL (usually the first one), and see the HTTP status of this request. If it's a 404: you're good.
You can also use Postman to get the HTTP response status of your URL. Or on CLI using Curl and many other ways.
Every time I need to update a post or page that uses Gutenberg blocks, I get a message in the dashboard that says "Updating failed. Error message: The response is not a valid JSON response.".
I also get errors on Chrome and Firefox developer console saying:
Access to fetch at 'https://website.com/wp-json/wp/v2/users/me?_locale=user' from origin 'https://www.website.com' has been blocked by CORS policy: Request header field x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response.
Could that be because the Rest URL has the 'www' on it? I can edit and save the posts normally on Safari, but not Chrome or Firefox.
Thanks
When you save the post in Gutenberg the wordpress backend page expects from the server a JSON formatted response. So when you get this error it means something on the backend/PHP side doesn't work as it should. In my case I've used print or echo functions instead of
return json_encode(array("with"=> "values"))
in an post save action hook callback.
The second error is not related to the first one. The ajax call url should just be equal to the window.location.origin value
On my Drupal sites if I go to fake url like: mysite.com/.htacess/nothing-here I get a 403 Forbidden (never hits Drupal). Is there a way we can redirect it to a 404 instead of 403?
In order to catch server 403 as custom 404 you need to use the ErrorDocument directive (assuming you're using Apache HTTP Server) :
In the event of a problem or error, Apache httpd can be configured to
do one of four things :
output a simple hardcoded error message
output a customized message
internally redirect to a local URL-path to handle the problem/error
redirect to an external URL to handle the problem/error
So to let Drupal handle the document, set the following (httpd.conf) :
ErrorDocument 403 /index.php
Note : Additional environment variables are available when an error redirect is sent : these variables are generated from the headers provided to the original request by prepending REDIRECT_ onto the original header name. This provides the error document the context of the original request (eg. REDIRECT_URL, REDIRECT_STATUS, REDIRECT_QUERY_STRING).
I'm a beginner of AMP from Japan.
Now I'm in trouble dealing with a error that is output when I introduce AMP into my WordPress webpage.
I cloud activate the AMP plugin and display an AMP of the post page without problem.
But the following error was output on my browser console when I added #development=1 to the end of URL of the post AMP to confirm whether the post AMP was configured as a valid AMP on Google.
Failed to load resource: the server responded with a status of 404 ()
https://cdn.ampproject.org/v0/validator_minified.js.sourcemap
Then I accessed to the above URL described in the error message, the following error page was displayed.
Google
404. That’s an error.
The requested URL /v0/validator_minified.js.sourcemap was not found on this server. That’s all we know.
I guess the output post AMP may not be recognized by Google as a structure of AMP if this error page was displayed.
But I have no idea to resolve the 404 error and can't progress any more.
In other words, I'd like to know some solution and hints to resolve the 404 error in order that Google recognizes my post AMP.
If you have some solution or hints, I'd be very helpful if you provide them for me.
Thanks in advance.
clear your cache in the server and delete your log. Blocking an malicious IP trafics and your see the IP in 30 per connection then you want blocked the IP.
Using proxy or like mitigation
I am using WP REST API in my wordpress blog. I am getting all the post using this link and it works fine. http://www.gmonetix.com/blog/wp-json/wp/v2/posts
But when I want to get a particular post by id such as http://www.gmonetix.com/blog/wp-json/wp/v2/posts/1122 , it shows 403: Error - access to the resource in this server is denied. Please give a solution for it.
You can retrieve single post by id like, this should work,
http://demo.wp-api.org/wp-json/wp/v2/posts/?filter[p]=1122
This URL gives response,
http://www.gmonetix.com/blog/wp-json/wp/v2/posts/?filter[p]=1122
I had the same issue. You can try disabling mod_security on your server or making an exception for mod_security for the REST endpoints. Also you can try WordPress on your local server and confirm issue.