i need to redirect my wordpress blog url to 404.php (file)

If some type wrong URL like example.com/blog/fgsdgfdg then I need to be redirect URL to example.com/blog/404.php

Below code not working

ErrorDocument 404 /404.php
  • I don't think you want an HTTP redirect here - you want broken links to be served as 404s so that search engines understand that they are broken. If you do want to redirect to a single page (and I'm not sure why) you probably want to do that as an HTML meta refresh or JavaScript to change the window location. You can do that from a 404 template. – Rup Sep 17 '20 at 11:59
  • Hi, thanks for reply, I want this to track the visitor like what happens when they enter the wrong URL and for this, I need to change URL in the address bar to get 404.php URL, I try some javascript code but not work, it says error "too many redirects" – ranbir Sep 18 '20 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.