How to redirect a custom link to a 404 page?

243 views Asked by At

In wordpress, I have plugin links that I don't want anyone accessing, therefore I want to redirect them to a 404 template that is in my child theme template, I searched and couldn't find anything related.

Let's say the links are:

http://example.com/wordpress/myPlugin/?r=34  
http://example.com/wordpress/myPlugin/?r=3  
http://example.com/wordpress/myPlugin/?r=  
http://example.com/wordpress/myPlugin/?r  
http://example.com/wordpress/myPlugin/?

The default response for the first link works fine, however altering these links as shown above would return a disclosure error that disclose file paths or info

1

There are 1 answers

0
J.P.M. On BEST ANSWER

You could use a simple 301 redirect in your .htaccess file

Redirect 301 /oldfolder/page2.html /folder3/page7.html

or there are many plugins (paid and free) that accomplish this for you through a pleasant GUI.